Hi,
We are working on the USB RNDIS communication between NXP iMXRT mpu and another embedded mcu board. As network stack we are using LwIP stack integrated with USB host library.
We had taken the demo example provided by iMXRT SDK in MCUXpresso IDE, it is working and we can establish the TCP server client communication after some modifications in the code.
Now we have ported our project into IAR EW, but when we run the code and starts the DHCP process, it hangs into the HardFault exception.
Do we need to do any extra settings for compiler to run in IAR? OR Do anyone have inputs on the above?
Do NXP have some example code for LwIP stack integrated and running for iMXRT processors?
Thanks in advance.
Pratik N.
I understand that your modified lwip_dhcp_usb demo does it works with the MCUXpresso IDE environment, but not in IAR. However, I still want to get more details.
MCUXpresso and IAR manage different linker scripts and setup options. Also you when doing code porting you need to be aware for any special MPU settings, memory layout, special allocation of code or variagbles. So we need to analyze this furter
All the best,
Diego
Hi,
Thank you for your response.
We have tested the demo code on IAR EW which was taken from IAR SDK for imxrt1170 mpu (lwip_dhcp_usb_demo) which contains only USB RNDIS and LWIP implementation, this works fine with IAR EW and MCUxpresso.
Q:Did you made code migration from scratch? or did you take the demo from the IAR SDK/DFP package?
Ans: We have added USB and LWIP related files in the code which was taken from from IAR SDK for iMXRT1170.
Q:Would you be able to share your code modifications via email? I will create an internal ticket for that, we can continue working on this here or there.
Ans: The project code contains the implementation which we cannot share here due to company policy.(We will check this if it can be shareble or not).
Q:Are you using one of our EVKs ? please specify the model and processor.
Ans: Yes, we are using the MIMXRT1170-EVK board (MIMXRT1176DVMAA), cortex M7 architecture
Q:Which SDK and IDE versions did you used?
Ans: we are using SDK_2.x_MIMXRT1170-EVK SDK, and MCUXpresso IDE v11.6.0 , IAR EW 9.30.1.50054).
Please let us know if you require any further information.
I made a follow up by the ticket I mentioned earlier regarding your code modifications, in case you could provide them to us.
Have you made any progress to trackdown the hardfault issue on your application?
Diego
Hi,
Thank you for following up on this issue.
To track down the issue, we took the demo exmple code (lwip_dhcp_usb_freertos) from the IAR SDK provided by NXP for imxrt1176 mpu and using the flexspi_nor_debug linker script. The project runs successfully when we use default linker script, but when we change the data sections from DTC RAM to either OC1_RAM or external SDRAM memory location, the code doesn't work.
Sometimes it gives the hardfault in the lwip functionality or sometimes it stucks in IDLE task only, not giving the execution time to other tasks and hence not communicating with USB host device.
We are not getting why lwip is giving different behaviour when running in DTC RAM or SDRAM?
Thanks and Regards,
Pratik
Regarding, We are not getting why lwip is giving different behaviour when running in DTC RAM or SDRAM?
Are those data sections in the default example? If yes, let me know their name.
Check for Memory protection unit settings, to see if the original area vs the new area for the data sections have different MPU r/w or access permissions.
Diego
Hi,
In default example, DATA_region uses DTC RAM location, and RW and ZI is placed at this region as below.
/*************************/
place in DATA_region { block RW };
place in DATA_region { block ZI };
/***************************/
When we add one more data region (DATA3_region) which uses SDRAM locations, and placed RW and ZI in SDRAM data region as below.
/*************************/
place in DATA3_region { block RW };
place in DATA3_region { block ZI };
/***************************/
This causes hardfault exception, not sure but it seems like unalignment memory access causing the fault.
Also as suggested by you we are looking into MPU settings.
Thanks and Regards,
Pratik.
Thanks for your reply!,
Yes please take a look at MPU settings made inside BOARD_ConfigMPU() . For example the internal SRAM and SDRAM may have different MPU settings. Could you make SDRAM area match internal SRAM settings?
Diego.