OSA_MemoryAllocate Error of USB Host on RT1064 EVK

cancel
Showing results for 
Search instead for 
Did you mean: 

OSA_MemoryAllocate Error of USB Host on RT1064 EVK

160 Views
namsu_mun
Contributor II

Hi,

I have tested USB Host function on i.MXRT160EVKDS, and found some error related with OSA_MemoryAllocate. I think USB host stack has problem, but it's not clear. I have attached test code (evkmimxrt1064_host_hid_generic_bm_1021a.7z). 

1. Used i.MXRT160EVKDS, MCUXpresso IDE v11.1.1 and  SDK_2.7.0_EVK-MIMXRT1064

2. Changed heap from SRAM_DTC to SRAM_OC (refer to evkmimxrt1064_host_hid_generic_bm_Debug.ld)

3. Found some problem when ran the code and connected USB device as followings;

p= 2020000c 68 20200074 (0)
host init done
p= 20200080 178 202001f8 (0)
p= 20200204 1b 20200220 (0)
newInstance->enumBuffer= 20200216
configureDesc->wTotalLength= 0 0
deviceInstance->configurationLen= 0
p= 0 0 20200220 (0)
ERROR! OSA_MemoryAllocate.. 20200220 (0)
configureDesc->wTotalLength= 0 0
deviceInstance->configurationLen= 0
p= 0 0 20200220 (0)
ERROR! OSA_MemoryAllocate.. 20200220 (0)
configureDesc->wTotalLength= 0 0
deviceInstance->configurationLen= 0
p= 0 0 20200220 (0)
ERROR! OSA_MemoryAllocate.. 20200220 (0)
configureDesc->wTotalLength= 0 0
deviceInstance->configurationLen= 0
p= 0 0 20200220 (0)
ERROR! OSA_MemoryAllocate.. 20200220 (0)
enumeration failed

Thanks,

Namsu

 

Labels (1)
0 Kudos
4 Replies

130 Views
namsu_mun
Contributor II

Hi,

I just want use standard malloc(), but default heap size too small. So I have changed heap memory from SRAM_DTC to SRAM to SRAM_OC. If it's not available now, I can find other solution such as private malloc(). Please let me know later if OSA_MemoryAllocate() is separated with standard malloc().

Thanks for your kind explanation,

Namsu

0 Kudos

111 Views
danielchen
NXP TechSupport
NXP TechSupport

From fsl_os_abstraction_bm.c,   OSA_MemoryAllocate called malloc directly.

 

void *OSA_MemoryAllocate(uint32_t length)
{
void *p = (void *)malloc(length);

if (NULL != p)
{
(void)memset(p, 0, length);
}

 

Regards

Daniel

return p;
}

 

0 Kudos

87 Views
namsu_mun
Contributor II

Hi,

As you mentioned already, it's not malloc problem.  The malloc just return 0 if the length is 0.

Regards,

Namsu

0 Kudos

134 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi

Some important USB structures should be placed in a Noncacheable Memory.  I would suggest you run USB host in SRAM_DTC, and put  other variables in SRAM_OC.   Could you please let me know why you change the heap to SRAM_OC?

 

Please refer to AN12042 for more details

https://www.nxp.com.cn/docs/en/application-note/AN12042.pdf

 

 

Regards

Daniel

0 Kudos