I'm using a K21FN1M0 device for a USB cdc project. I've got the USB CDC PE component from MCUoneclipse source forge page: FSL_USB_STACK.
When first connected to a PC, the USB full-speed packets appear every one millisecond.
But as soon as the COM port is open, the rate of traffic increases massively. Packets are sent as frequently as every 3us and with varying length. However, the K21 sits in idle and only transmit a string every 5 seconds.
My questions are:
1 - what are this traffic? Are they standard USB traffic?
2 - If this traffic is not necessary, is there any software change to get reduce (or get rid of) this massive amount of traffic as it causes EMC test to fail in 7-10MHz region?
Any help is appreciate.
The traffic is coming from the USB host and not the device.
USB-CDC uses bulk mode and the USB host will be able to define almost the complete USB bandwith to the bulk IN polling (assuming not using a hub or a composite device), meaning that it is sending IN token, which your device wil be NAKing at the hardware level (the USB FS device does this when it has no data to return). Therefore it is polling as fast as it can.
USB cabes and screening are designed and specified so that this can usually be tolerated. If your EMV emission levels are too high check the quality of the USB cable used (cables with USB logo should be certfied for the operation but cheap black-market copies will possibly not). Also check the ends of the USB cable and the earthing to housing and the board. Usually earthing at only one end is recommended and the grounding at the board via ferrite elements can be useful. Also check the recommendation in the USB specification - EMC behavior is a part of its specification and so the specification gives a lot of practical details along with rules to be followed.
P.S: The traffic on the USB can only be redued by avoiding classes that using bulk IN endpoints and poll only using interrupt IN endpoints, where the speed of polling is then defined and fixed (eg. once every 32ms) but it is beter to solve the problem with a solid HW design since this is possible.
For the complete "out-of-the-box" Kinetis experience and faster time to market
Thanks for your comprehensive response. I'm using this USB device for an avionic application so the EMC requirement is pretty tight.
I use CDC in the first place because I want the K21 to enumerate as COM port on a PC for straightforward software development.
For now, I'll try the hardware approach.