Conceptual Question (USB Data Transfer)

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: tfAteba, barthess, RoccoMarco, lbednarz, utzig

robert_o
Posts: 50
Joined: Fri Feb 17, 2017 11:25 pm
Has thanked: 1 time
Been thanked: 5 times

Conceptual Question (USB Data Transfer)

Postby robert_o » Tue Jun 04, 2024 9:58 am

Hello everybody,
i would like to build an XSFV Player (CPLD Programmer) with ChibiOS. I already have a working Version on: (Github).
The Board is a STM32F401 "BlackPill" Board.
I have a modified communications protocol from an old project which uses a block transfer with checksum. The client on the PC Side is written in python3.
First Question: is this necessary with USB Transfer (ttyACM USB-Serial Implementation)?
For now it works fine because it transfers the whole Data in one swoop (~29kB), but this only works with the XC9572, for different CPLDs the data size is too big for the RAM available (about 32k for the buffer works).
I need a transfer method which can send data to the STM32 over USB and this one can stop or slow down the transfer so i can have a progress bar in python. It would be much easier without the checksum calculation.
Second question: what would be a good way to implement this using chibios "tools"?

Thank you.
Robert.

User avatar
Giovanni
Site Admin
Posts: 14565
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1112 times
Been thanked: 937 times
Contact:

Re: Conceptual Question (USB Data Transfer)

Postby Giovanni » Tue Jun 04, 2024 11:52 am

Hi,

Over a virtual com port you could send the data in chunks, 4kB for example, and add a CRC/checksum to each chunk. After each chunk you could send and ACK or a NACK back to the host in order to make it send the next chunk or re-send the previous one.

Add timeouts and you will have a pretty solid protocol.

Giovannii

robert_o
Posts: 50
Joined: Fri Feb 17, 2017 11:25 pm
Has thanked: 1 time
Been thanked: 5 times

Re: Conceptual Question (USB Data Transfer)

Postby robert_o » Tue Jun 04, 2024 6:37 pm

Thanks for your reply Giovanni.
That is what i am doing now. I send 16k in a 32k buffer and start a "write thread" if the checksum is ok. Then i send another 16k in the second half while the writing of the data continues.
I just have some problems with the feedback how much is written already, it interferes with the communication.
Also the problem with fixed size transfers is that the xsvf protocol underneath has command-blocks of variable length and you can not break up a command because it messes up the xsvf state machine.
-robert


Return to “General Support”

Who is online

Users browsing this forum: No registered users and 9 guests