cdc debug console hangs with repeated data

cancel
Showing results for 
Search instead for 
Did you mean: 

cdc debug console hangs with repeated data

Jump to solution
452 Views
inorman
Contributor III

Hi,

We've a project that uses the K64 usb port as a CDC serial port using the debug console with SDK 1.3 with PE , but it hangs when data is sent regularly to it.

 

I've stripped the program back so it's just calling debug_getchar();

and then sending that char straight back out with  debug_putchar(temp);

 

I used termite (a simple terminal program) just to send back a test message, so the whole thing will keep looping, after a few minutes the K64 will crash.

 

Any thoughts?

Labels (1)
0 Kudos
1 Solution
220 Views
therealfreegeek
Contributor IV

Do you have any long interrupts occurring?

I had a similar problem, my code was working well, it was tested running for 2 weeks, then at some point later I modified a PIT interrupt which toggled a pin, to toggling the pin twice with a random period of up to 10uS between toggles.

It was only later I noticed that the s/w would lock up when tested for a few hours, it took a while for me to link the two.

Modifying the interrupt back to the way it was negated the problem. Subsequent tests running for 3 weeks ran error free.

It seems like my long (well up to 10uS) was interfering with the operation of the USB peripheral or driver.

View solution in original post

0 Kudos
4 Replies
221 Views
therealfreegeek
Contributor IV

Do you have any long interrupts occurring?

I had a similar problem, my code was working well, it was tested running for 2 weeks, then at some point later I modified a PIT interrupt which toggled a pin, to toggling the pin twice with a random period of up to 10uS between toggles.

It was only later I noticed that the s/w would lock up when tested for a few hours, it took a while for me to link the two.

Modifying the interrupt back to the way it was negated the problem. Subsequent tests running for 3 weeks ran error free.

It seems like my long (well up to 10uS) was interfering with the operation of the USB peripheral or driver.

0 Kudos
220 Views
inorman
Contributor III

Hmm you could be on to something, I've a timer interrupt to flash a led in an fpga via spi... I'll take that out and give it a go.

Thanks

0 Kudos
220 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Norman,

I am sorry for the delay. Can you use SDK2.0 to develop the code?

There is example code for cdc, you can refer to it:

C:\Freescale\SDK2.0_K82\boards\frdmk82f\usb_examples\usb_device_cdc_vcom\freertos\kds

Regarding your function debug_getchar(); and debug_putchar(temp); the two functions use UART to transfer data or use cdc which is implemented in K20 on the FRDM or tower board of K64. Do you encapsulate the above two function with the USB CDC class on K64?

Do you use FRDM-K64F, TWR-K64 or the target board you designed?

BR

Xiangjun Rong

0 Kudos
220 Views
inorman
Contributor III

Hi thanks for getting back to me,

Probably too late in the day to switch to SDK2.0 unless I can just insert the usb code alongside the other drivers as our boards are at prototype stage with customers.

This is on our own custom board using a MK64FN1M0VLQ12

Yes the functions are setup using the PE libraries fsl_usb_framework and fsl_debug_console.

With the symbol use "BOARD_USE_VIRTUALCOM" enter under the settings “C/C++ Build >> Settings >> Cross ARM C Compiler >> Preprocessor

and call DbgConsole_Init(BOARD_DEBUG_UART_INSTANCE, DEBUG_UART_BAUD, kDebugConsoleUSBCDC); 

at the start of main program.

All works well, except when the usb uart is continuously polled.

Any further thoughts?

Kind regards

Ian Norman

0 Kudos