port from 2.6.x to 3.1.x : usb-cdc flush behavior

Discussions and support about ChibiOS/RT, the free embedded RTOS.
Post Reply
User avatar
alex31
Posts: 445
Joined: Fri May 25, 2012 10:23 am
Has thanked: 57 times
Been thanked: 88 times

port from 2.6.x to 3.1.x : usb-cdc flush behavior

Post by alex31 »

Hello, i am in the process of porting all my stuff to ChibiOS 3.1. Most of the time, it works flawlessly.

With usb-cdc, i notice different behaviour between 2.6 and 3.1 :

2.6 : data is flushed after each chSequentialStreamWrite
3.1 : data is flushed only after the buffer of size SERIAL_USB_BUFFERS_SIZE if full

To let my application run, I have lowered SERIAL_USB_BUFFERS_SIZE, but it's not ideal,
is there any means to flush data after a chSequentialStreamWrite on usb-cdc ?

Thanks,
Alexandre
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: port from 2.6.x to 3.1.x : usb-cdc flush behavior

Post by Giovanni »

Hi,

Look at the latest demos, there is a new function to associate to the periodic USB callback, it flushes the buffer automatically. Examples are in any usbcfg.c file.

Giovanni
User avatar
alex31
Posts: 445
Joined: Fri May 25, 2012 10:23 am
Has thanked: 57 times
Been thanked: 88 times

Re: port from 2.6.x to 3.1.x : usb-cdc flush behavior

Post by alex31 »

Yes, the sduSOFHook stuff and associated callback do the job.

Thanks !

Alexandre
Post Reply