Problem with Azure USBX in MIMXRT1015EVK

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Problem with Azure USBX in MIMXRT1015EVK

Jump to solution
1,454 Views
dani_sanz
Contributor I

So I have implemented my own USB device class using Azure RTOS's USBX, actually based on the example DPUMP class, and very similar to it.

I am using gcc-arm-none-eabi-10 compiler, and in debug configuration (no optimizations -Og flag) my project compiles and runs correctly: I have a thread which handles my USB class, and I can communicate with a PC (running as a USB Host), transmitting and receiving data buffers, very similarly to what the DPUMP example does.

My problem comes when I increment the optimization level of GCC: even if I compile my project with -O1 flag, the processor gets stuck in the USB stack and never exits. I have traced the source of the issue, and the problem seems to be inside the "usb_device_controllers" folder, specific to the i.MXRT chip (I am using the most recent MCUXpresso SDK, 2.9.1): my code gets stuck in the while() loop of the ux_dcd_mcimx6_endpoint_flush.c file, but the cause of the problem is in the file ux_dcd_mcimx6_transfer_callback.c, around the line 277: I can see that the processor gets inside this loop even if "qtd" is 0. I don't know how this is possible, but I suspect this is a bug because there is a comment in line 276 saying that this has not been tested.

If I compile the file ux_dcd_mcimx6_transfer_callback.c with no optimization (-O0) and the rest of the files of the project with -O3, it works fine.

I have also found that the problem happens when my USBX memory area (the one I pass as the first argument to the function ux_system_initialize()) is defined in the OCRAM of the chip (I configure the MPU to make this region a shared, non-cacheable region). If I define the USBX memory area inside the DTCM, the problem disappears.

What can the issue be?

Labels (1)
Tags (3)
0 Kudos
1 Solution
1,236 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi

 

SDK 2.10 is released. I would suggest you try it in sdk2.10.

 

Regards

Daniel

View solution in original post

0 Kudos
3 Replies
1,419 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi Dani:

Which demo you are using, and how can I reproduce this issue on NXP evk board?

 

Regards

Daniel

0 Kudos
1,405 Views
dani_sanz
Contributor I

I am not using a demo, I am using my custom application. However I have developped it based on 2 demos:

I have taken all the USB device initialization stuff (i.MXRT specific) and the USBX_device_controllers folder from the "usbx_device_mass_storage" example in the i.MXRT1015EVK SDK version 2.9.1. However this demo uses the external flash, and I have changed the linker script so that everything (code+data) is in the internal RAMs.

I have written a custom USB class, but it is very similar to the DPUMP class which is included as an example in USBX. A demo for this can be found in the same SDK 2.9.1, in the path rtos/azure-rtos/usbx/samples/demo_usbx.c.

 

Tags (1)
0 Kudos
1,237 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi

 

SDK 2.10 is released. I would suggest you try it in sdk2.10.

 

Regards

Daniel

0 Kudos