Write command for ALFAT OEM

I come out of reset.
I read the banner, it is good.
I mount the sd card, it is good.
I open a file to append to, it is good.
Next is the 16 bytes I try to write.
I give write command, it is good.
I write 16 bytes and …,No response.
Flush command, No response.

See anything wrong here?

Thanks!

go

GHI Electronics, LLC
----------------------
ALFAT SoC Processor
!00

I M:
!00

O 0A>M:\data.dat
!00

D15,96D0,3D,2DB7
W 0>10
!00

D15,96D0,3D,2DB7
F 0

I tried the L command and it does respond.
However, the written file is not correct.

3320,38611,63,11702
was written.
The file has
49 49 02 49 02 49 02 49 02 49 02 49 02 49 02 49 02 49 02 49 02
21 bytes, just not the 21 bytes I was hoping for.

go

GHI Electronics, LLC
----------------------
ALFAT SoC Processor
!00

I M:
!00

O 0W>M:\data.csv
!00

3320,38611,63,11702

L 0>15
!00

3320,38611,63,11702

$00000015
!00

C 0
!00

L 0>8000
!00

$00008000
!00

I send alfat a command that I will 0x8000 bytes.

I only send 0x100

and alfat says ok I received 0x8000 with no error.

Data in file show 0x100 bytes and then zeros until 0x2000 and repeats the first 0x100
And again at 0x4000 and 0x6000.

So WHY?

It is supposed to wait until it receives all 0x8000.
What is going on?

@ thombus -

L command will receive 8KB per block.

  • You tell ALFAT 0x8000, you should send 4 blocks, each block will be 8KB
  • You tell ALFAT 0x8001, you should send 5 blocks with 4 first block for 8KB and last block is 1 byte.

Edit:

it is about 25ms timeout

Hi,
i have the same problem with the W command.
I come out of reset.
I read the banner, it is good.
I mount the sd card, it is good.
I open a file to append to, it is good.
Next is the 16 bytes I try to write.
I give write command, it is good.
I write 32 bytes and …,No response.

what can i do, i need help.
Thank you
Dominique

[quote]I open a file to append to, it is good.
Next is the 16 bytes I try to write.
I give write command, it is good.
I write 32 bytes and …,No response.
[/quote]

When you write by W command, ALFAT will send back “!00\n” then wait for data.
You have to send 3 bytes of header (for write transaction) + 32 bytes raw data, total 35 bytes.

3 bytes of header are:
1st: 1 - for write
2nd+3rd: size of raw data, here it should be 32

So I think after you received first “!00\n” from “W” command, you have to send

0x01,0x00, 0x20 and 32 bytes of raw data

ALFAT doesn’t response because you sent wrong format or not enough data and it is in waiting state.

And, W command you need to send 3 bytes header before you send raw data,
but L command, no header needed for raw data.