Hi! I keep getting what I believe to be memory leak when using USB Host in MQX. I am using Codewarrior 10.6 with MQX 4.1.1. With the USB Host Debug prints enabled I get:
_usb_host_recv_data
_usb_host_set_up_tr
_usb_host_get_tr_element
_usb_host_new_tr_element
_usb_host_new_tr_element malloc failed
_usb_host_new_tr_element FAILED
_usb_host_set_up_tr NULL transaction
_usb_host_recv_data transfer queue failed
Error with _usb_host_recv_data: 81
USB Memory Allocation Error
I've tried various things to correct this problem, but I would really like some suggestions on what I may be doing wrong. When I only receive from the device, this error doesn't happen. However after a certain number of sends to the USB device, I eventually get this receive error. How do I release or allocate more memory for a _usb_host_recv_data command?
Thanks in Advance,
Colin
已解决! 转到解答。
Hi Colin:
I suspect there are some memory issues in the old usb stack (MQX 4.1). I would suggest you try MQX 4.2.
In MQX 4.2, there are two usb folders, one is usb, that is the legacy usb stack. ( same as MQX 4.1, with some minor changes). the other usb folder is usb_v2. This is a completely new implementation of usb stack, it fixed some usb issues, which are hard to fix in the legacy usb stack.
unfortunately, usb_v2 only supports k22, K24,k64, K65.
K60FN1M0VLQ12 is not supported in USB_V2. If you need to run usb_v2 with K60 board, you need to do some porting work. I have customer who ported this version by himself.
I guess USB_V2 fixed your issue.
If you have new MCU, such K64/k65/...,or k60 100M, then you can try MCUXpresso SDK.
Regards
Daniel
Hi Colin:
I suspect there are some memory issues in the old usb stack (MQX 4.1). I would suggest you try MQX 4.2.
In MQX 4.2, there are two usb folders, one is usb, that is the legacy usb stack. ( same as MQX 4.1, with some minor changes). the other usb folder is usb_v2. This is a completely new implementation of usb stack, it fixed some usb issues, which are hard to fix in the legacy usb stack.
unfortunately, usb_v2 only supports k22, K24,k64, K65.
K60FN1M0VLQ12 is not supported in USB_V2. If you need to run usb_v2 with K60 board, you need to do some porting work. I have customer who ported this version by himself.
I guess USB_V2 fixed your issue.
If you have new MCU, such K64/k65/...,or k60 100M, then you can try MCUXpresso SDK.
Regards
Daniel
Reference: https://community.nxp.com/message/536947
Q?: Please notice that USB_v2 projects don't have any build files for cw10gcc as exist in all other projects (bsp, psp, mfs, rtcs, usb, etc....). is there any specific reason for that? Does it mean that the new unified USB stack is not meant for use with Codewarrior?
A: Unfortunately it is right, however you can use other IDE's like KDS, Keil, IAR.
KDS is free and you can download it from the next link: Kinetis Design Studio Integrated Development |Freescale
I found this thread and I basically have the same question. Is it possible to port USB_V2 into a CodeWarrior project?
What development platform was used when your other customer ported USB_V2 over?
Thanks!
Colin
Daniel,
Thank you for your post. Currently, I have done step one and moved over to MQX 4.2. As you stated, the problem still exists in MQX 4.2 using the old USB stack. Now for step two, I am going forward with porting USB_V2 to the K60FN1M0VLQ12. Is there any additional information that I can use to make this porting of a USB Stack easier? I found the 8 manuals and plan to start with the USB Stack Porting Users Guide.
I have considered switching to MCUXpresso SDK, but at this point in our project I can't switch over chips without changing our board layout. Again, I think this will be a project for a later date.
Thanks Again for Your Time,
Colin