Main Site Documentation

Write data to USB


#1

I would like to write 360,000 characters to a file. The write transaction request frame only allows a 16bit size payload, or a max write of 65,535.

Do I need to send multiple write commands with 1 write transaction request frame

or

can I send 1 write command with the total size to be written (“W 0>57E40\r”) and then multiple write transaction frames?


#2

You need to repeatedly send the wire command followed by the requested payload size.


#3

So to understand, I need to send
"W 0>FFFF\r" (this is the max allowed) followed by
0x01
0xFF
0xFF
data ( Byte 1 Byte 2 … Byte FFFF)

“W 0>FFFF\r” (this is the max allowed) followed by
0x01
0xFF
0xFF
data ( Byte 1 Byte 2 … Byte FFFF)
.
.

6 times instead of sending

“W 0>57E40\r” followed by
0x01
0xFF
0xFF
data ( Byte 1 Byte 2 … Byte FFFF)

0x01
0xFF
0xFF
data ( Byte 1 Byte 2 … Byte FFFF)

0x01
0xFF
0xFF
data ( Byte 1 Byte 2 … Byte FFFF)
.
.
.

Why does the WRITE to FILE command have a 4byte size (FFFFFFFF) if the max payload is only 2 bytes (FFFF)?


#4

@ vb74 -

I think we are talking about SPI?

If so, the limitation 0xFFFF is only for SPI frame.

The command “W 0>FFFF…” is a ALFAT command, it is same for all UART, I2C, SPI and the limitation is up to 0xFFFFFFFF.

they are separated. If you are seeing something in document which let you to be confused, let us know.

Thanks.

Edit:

To more clear, SPI frame can be sent many times to reach the expected length.
But the ALFAT command “W 0>FFFFFFFF.” is only one time, if file size is smaller than 0xFFFFFFFF.