USB CDC buffer initialization

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

USB CDC buffer initialization

ソリューションへジャンプ
15,934件の閲覧回数
SantiZ
Contributor I

Hi,

  

I'm using K70 with MQX system and USB CDC as virtual COM port to send data. From time to time, I can see 12 bytes of data corruption within the sent data package from the receive side. I checked the buffer used to send data by calling USB_Class_CDC_Send_Data() and found that the buffer is allocated by malloc(). I changed the initialization by calling the function in MQX library _mem_alloc_uncached() and the data corruption went away.

  

I tried to look for the reference on the reference manual about data buffer used in USB transaction but I couldn't find anything. Is there any recommendations on the buffer used in USB has to be allocated in the uncached memory? I want to make sure my change was not just shifting the timing and drive the real problem elsewhere.

  

The USB is configured in high-speed mode and use a bulk size of 512. USB is running in device mode using EHCI as device controller. Our hardware board is using a USB3300 PHY.

  

Thanks in advance!

  

Best Regards,

Lecheng

タグ(3)
0 件の賞賛
返信
1 解決策
2,116件の閲覧回数
danielchen
NXP TechSupport
NXP TechSupport

Hi Lecheng

User application buffers used by USB EHCI Class drivers have to reside in un-cached memory space.

I hope it helps

Regards

Daniel

元の投稿で解決策を見る

0 件の賞賛
返信
3 返答(返信)
2,117件の閲覧回数
danielchen
NXP TechSupport
NXP TechSupport

Hi Lecheng

User application buffers used by USB EHCI Class drivers have to reside in un-cached memory space.

I hope it helps

Regards

Daniel

0 件の賞賛
返信
2,116件の閲覧回数
rand_monteleone
Contributor I

Hi Daniel,

Would it be acceptable to use a cached buffer and call _DCACHE_FLUSH_MLINES to flush the cache right before sending the data on USB?

Thank you,

Rand Monteleone

0 件の賞賛
返信
2,116件の閲覧回数
SantiZ
Contributor I

Hi Daniel,

Thank you for the confirmation.

Have a nice day,

Lecheng

0 件の賞賛
返信