USB overwriting data array

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Not applicable
I am using ADCSYNC to sample 4 channels simultaneously. The adc fills up 4 arrays which is subsequently transmitted to a host pc over USB upon reaching a predefined number of samples. Before USB transmission is initiated the sampling interrupt is stopped.

It seems, however, that somehow the USB is writing to a certain memory address which is also contained in one of my data arrays, and I loose that particular data.
The problem occurs at the same address every time (word at 0x20000CD0). Using the debugger I could assert that the data is sampled correctly, but when the code proceeds to USB tasks the particular memory is overwritten before being transmitted to the host.
I cannot identify the precise command that is responsible for the write operation, but I am convinced that is the usb - watchpoint does not pick it up???
The above happens with the USBD_VCOM app on the XMC4400.
When I try to use the old app (USBVC001) I get a busfault error. In this case I can identify (using watchpoints) that the USB app is again using memory that overlaps with my data array. When transmission begins the mcu hangs and it indicates a busfault.

How should I try to debug this behavior and how can I find the process that is violating my data? Is there a way to specify the address where I initialize my data arrays to maybe avoid the overlap?

Regards,
Frik
0 Likes
0 Replies