OSA_MemoryAllocate Error of USB Host on RT1064 EVK

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

OSA_MemoryAllocate Error of USB Host on RT1064 EVK

1,507件の閲覧回数
namsu_mun
Contributor III

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

 

ラベル(1)
0 件の賞賛
返信
4 返答(返信)

1,476件の閲覧回数
namsu_mun
Contributor III

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 件の賞賛
返信

1,457件の閲覧回数
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 件の賞賛
返信

1,433件の閲覧回数
namsu_mun
Contributor III

Hi,

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

Regards,

Namsu

0 件の賞賛
返信

1,481件の閲覧回数
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 件の賞賛
返信