The interface is configured during power up with the following pins within 10ms after reset.
The interfaces have internal input and output buffers (each 8192 bytes) and can receive up to 4096 bytes, when the busy pin is low.
When the FATSC controller is started in bootloader mode then it automatically searches all available devices for a FIRMWARE.IMG
file in the root directory.
If a newer firmware version is found within 5s then an update will be done and the new firmware will be started (with interface selected by pin states).
Always ensure that there is no power outage and it is also not allowed to reset the FATSC controller during the update process.
The update can take up to 15s.
Pin states to select the interface:
UART settings:
Startup message (after max 1s):
<LF>
Bootloader<LF>
Firmware v3.0.0<LF>
!FF<LF>
Pin states to select the interface:
UART settings:
planned feature - not implemented yet
Pin states to select the interface:
I2C settings:
Pin states to select the interface:
SPI settings:
Frame format:
Write:
|_Pin__|__Type__|_Payload Size__|_________Payload_________|
| MOSI | 0x01 | LSB | MSB | Byte 0 | ... | Byte N |
| MISO | Ignore | Ready | Ready | Ready | Ready | Ready |
Read:
|_Pin__|__Type__|_________Request Size__________|________Payload_________|
| MOSI | 0x02 | Request LSB | Request MSB | 0x00 | 0x00 | 0x00 |
| MISO | Ignore | Available LSB | Available MSB | Byte 0 | ... | Byte N |
Commands end with <LF>
and numbers are written as strings of hexadecimal digits (ASCII), e.g. 16 would be 12 (bytes 0x31 and 0x32).
The response time is under 100ms, when auto mount is disabled.
Carriage return <CR>
is interpreted as line feed <LF>
on commands.
Hexadecimal digits A to F must be upper case.
<LF> = 0x0A (line feed)
<CR> = 0x0D (carriage return)
<SP> = 0x20 (space)
{RR} = result code (hex value)
Startup message (after max 1s):
<LF>
Storage Controller <LF>
----------------------<LF>
FATSC SoC Processor <LF>
!00<LF>
Mount the respective device and set the file listing (N
command) to the root directory.
The initializing process can take up to 5 seconds.
I<SP>{D}<LF>
{D}
drive name:M:
Memory cardU0:
USB drive 0U1:
USB drive 1!{RR}<LF>
{RR}
00
initializing and mounting successful02
incorrect parameters11
initializing or mounting failed60
EFC event/interrupt has occurredGet the free size in bytes of a mounted drive.
K<SP>{D}<LF>
{D}
drive name:M:
Memory cardU0:
USB drive 0U1:
USB drive 1!{RR}<LF>
${XXXXXXXXXXXXXXXX}<LF>
!{RR}<LF>
{XXXXXXXXXXXXXXXX}
free bytes (hex value){RR}
00
command successful02
incorrect parameters03
command failed60
EFC event/interrupt has occurredFormat drive. Note, the format process cannot be aborted also not with an EFC event.
Q<SP>CONFIRM FORMAT<SP>{D}<LF>
{D}
drive name:M:
Memory cardU0:
USB drive 0U1:
USB drive 1!{RR}<LF>
!{RR}<LF>
{RR}
00
format successful02
incorrect parameters03
format failed, check if device is read-only60
EFC event/interrupt has occurredOpen the respective file.
O<SP>{H}{M}>{F}<LF>
{H}
handle: 0...F
{M}
mode: R
=read, W
=write, A
=append (W
and A
will create the file if it does not exist){F}
filename with path, e.g. “U0:/path/filename.txt”!{RR}<LF>
{RR}
00
file opened successfully02
incorrect parameters03
command failed, write to read-only device20
file does not exist21
failed to open the file26
file name exists37
file handle in use60
EFC event/interrupt has occurredClose the respective file.
C<SP>{H}<LF>
{H}
handle: 0...F
!{RR}<LF>
{RR}
00
file closed successfully02
incorrect parameters03
command failed, file not closed30
invalid file handle36
file handle does not open or is not in use60
EFC event/interrupt has occurredRead data from file.
R<SP>{H}{F}>{N}<LF>
{H}
handle: 0...F
{F}
filler byte{N}
bytes to read (hex value)!{RR}<LF>
Data-Bytes
${XXXXXXXX}<LF>
!{RR}<LF>
{XXXXXXXX}
valid bytes without filler (hex value){RR}
00
command successful02
incorrect parameters03
command failed36
file handle does not open or is not in use3A
file handle requires read mode60
EFC event/interrupt has occurredWrite data to file.
W<SP>{H}>{N}<LF>
{H}
handle: 0...F
{N}
bytes to write (hex value)!{RR}<LF>
Data-Bytes (from host)
${XXXXXXXX}<LF>
!{RR}<LF>
{XXXXXXXX}
bytes written (hex value){RR}
00
command successful02
incorrect parameters03
command failed36
file handle does not open or is not in use39
file handle requires write or append mode60
EFC event/interrupt has occurredThis command copies data from one file to another file.
M<SP>{S}<SP>{O}<SP>{D}<SP>{N}<LF>
{S}
source handle: 0...F
{O}
offset of source file (hex value){D}
destination handle: 0...F
{N}
bytes to copy (hex value)!{RR}<LF>
${XXXXXXXX}<LF>
!{RR}<LF>
{XXXXXXXX}
bytes copied (hex value){RR}
00
command successful02
incorrect parameters03
command failed23
offset value can only be within the file size31
source handle does not open32
destination handle does not open33
source handle requires read mode34
destination handle requires write or append mode60
EFC event/interrupt has occurredThis command flushes the cached information of a writing file. The close command will also flush the data before closing the file.
F<SP>{H}<LF>
{H}
handle: 0...F
!{RR}<LF>
{RR}
00
command successful02
incorrect parameters03
command failed36
file handle does not open or is not in use60
EFC event/interrupt has occurredSet the current byte position relative to the file start (0).
P<SP>{H}>{N}<LF>
{H}
handle: 0...F
{N}
byte position (hex value)!{RR}<LF>
{RR}
00
command successful02
incorrect parameters03
command failed22
seek only runs on files open for read23
position value can only be within the file size36
file handle does not open or is not in use60
EFC event/interrupt has occurredGet the current byte position from file start (0).
Y<SP>{H}<LF>
{H}
handle: 0...F
!{RR}<LF>
${XXXXXXXX}<LF>
!{RR}<LF>
{XXXXXXXX}
byte position (hex value){RR}
00
command successful02
incorrect parameters36
file handle does not open or is not in use60
EFC event/interrupt has occurredRename file.
A<SP>{F}>{N}<LF>
{F}
old filename with path, e.g. “U0:/path/filename.txt”{N}
new filename without path, e.g. “newname.txt”!{RR}<LF>
{RR}
00
command successful02
incorrect parameters03
command failed60
EFC event/interrupt has occurredDelete file or folder.
D<SP>{F}<LF>
{F}
filename or folder, e.g. “U0:/path/filename.txt”!{RR}<LF>
{RR}
00
command successful02
incorrect parameters03
command failed20
file/folder does not exist60
EFC event/interrupt has occurredFind the respective file or folder.
?<SP>{F}<LF>
{F}
filename, e.g. “U0:/path/filename.txt”!{RR}<LF>
${XXXXXXXX}<LF>
${AA}<LF>
${HH:MM:SS MM-DD-YYYY}<LF>
!{RR}<LF>
{XXXXXXXX}
size in bytes (hex value){AA}
FAT attributes (hex value){HH:MM:SS MM-DD-YYYY}
modified date and time{RR}
00
command successful02
incorrect parameters03
command failed20
file/folder does not exist60
EFC event/interrupt has occurredStart file and folder listing.
@<SP>{F}<LF>
{F}
folder/directory with path, e.g. “U0:/path/folder”!{RR}<LF>
{RR}
00
command successful02
incorrect parameters03
command failed20
folder does not exist60
EFC event/interrupt has occurredGet next result of file and folder listing.
N<LF>
!{RR}<LF>
{NAME}<LF>
${AA}<LF>
${XXXXXXXX}<LF>
!{RR}<LF>
{NAME}
file/folder name{AA}
FAT attributes (hex value){XXXXXXXX}
size in bytes (hex value){RR}
00
command successful02
incorrect parameters03
command failed04
reached end of the file/folder list, this is not an error60
EFC event/interrupt has occurredRead respective status register.
J<SP>{N}<LF>
{N}
register:0
device status1
file status2
auxiliary status!{RR}<LF>
${S}<LF>
!{RR}<LF>
{S}
status (hex value)0
device status (8 bit)1
file status (16 bit)0
used … bit 15: 1=handle F
used2
auxiliary status (16 bit){RR}
00
command successful02
incorrect parameters60
EFC event/interrupt has occurredSet system mode or registers.
Z<SP>{N}{>{V}}<LF>
{N}
register:0
start standby mode (without parameter), this will disable EFC and unmount all devices1
start stop mode (without parameter), this will disable EFC and unmount all devices2
wakeup pin function: 0=wakeup, 1=EFC (emergency flush and close), if EFC is triggered the current command will be aborted3
reboot4
0=auto mount off, 1=auto mount on (no mounting with I
command needed), there can be a response delay up to 500ms, when a new USB device is connected5
SD WP overwrite: 0=off, 1=on{V}
parameter value, e.g. Z<SP>4>1<LF>
to activate auto mounting!{RR}<LF>
{RR}
00
command successful02
incorrect parameters60
EFC event/interrupt has occurredGet the time and date.
G<SP>{N}<LF>
{N}
date or time:D
dateT
timeG
time and date{MM-DD-YYYY}<LF>
{HH:MM:SS}<LF>
{HH:MM:SS MM-DD-YYYY}<LF>
!{RR}<LF>
{MM-DD-YYYY}
date D
response{HH:MM:SS}
time T
response{HH:MM:SS MM-DD-YYYY}
time and date G
response{RR}
00
command successful02
incorrect parameters60
EFC event/interrupt has occurredSet the time and date.
S<SP>{DDDDTTTT}<LF>
{DDDDTTTT}
date and time as 32 bit hex value or HH:MM:SS MM-DD-YYYY
string!{RR}<LF>
{RR}
00
command successful02
incorrect parameters03
command failed60
EFC event/interrupt has occurredThe clock source of the RTC is automatically selected and this command checks the current RTC clock source.
T<SP>{M}<LF>
{M}
RTC mode:S
shared modeB
backup mode with crystal (LSE) and battery!{RR}<LF>
{RR}
00
command successful, RTC mode is the requested one02
incorrect parameters03
command failed60
EFC event/interrupt has occurredSet the UART baud rate.
B<SP>{N}<LF>
{N}
baudrate as 32 bit hex value!{RR}<LF>
!{RR}<LF>
{RR}
00
command successful02
incorrect parameters60
EFC event/interrupt has occurredTest read and write speeds of a mounted drive.
E<SP>{D}>{S}<LF>
{D}
drive name:M:
Memory cardU0:
USB drive 0U1:
USB drive 1{S}
number of bytes to test (hex value)!{RR}<LF>
${AAAAAAAA}<LF>
${BBBBBBBB}<LF>
!{RR}<LF>
{AAAAAAAA}
milliseconds of writing (hex value){BBBBBBBB}
milliseconds of reading (hex value){RR}
00
command successful02
incorrect parameters03
command failed60
EFC event/interrupt has occurredGet the firmware version.
V<LF>
v{X.X.X}<LF>
!{RR}<LF>
v{X.X.X}
version, eg. v3.0.0
{RR}
00
command successful60
EFC event/interrupt has occurredUpdate the firmware with a subsequent restart. A downgrade to a lower version is not possible. Always ensure that there is no power outage and it is also not allowed to reset the FATSC controller during the update process. Please wait for a response code or after the reboot for the startup message. The update can take up to 15s and the interface is selected by pin states after the restart.
U<SP>{F}<LF>
{F}
filename with path, e.g. U0:/firmware.img
!{RR}<LF>
{RR}
03
programming error or checksum error, restart the device and try again21
file not found or incompatible file, check the file name and if the drive is initializedon success startup message with result code 00
:
<LF>
Storage Controller <LF>
----------------------<LF>
FATSC SoC Processor <LF>
!00<LF>
No operation (NOP).
<LF>
!00<LF>
Code | Description |
---|---|
00 | OK, command successful |
01 | Unknown command |
02 | Incorrect parameters |
03 | Operation failed, also returned on a write to a write-protected card |
04 | Reached end of the file/folder list, this is not an error |
11 | Initialize media/drive failed |
12 | Not enough free space on media |
20 | File/folder does not exist |
21 | Failed to open the file |
22 | Seek only runs on files open for read |
23 | Position value can only be within the file size |
26 | File/folder name already exists |
30 | Invalid file handle |
31 | Source file handle does not open |
32 | Destination file handle does not open |
33 | Source file handle requires read mode |
34 | Destination file handle requires write or append mode |
36 | File handle does not open |
37 | File handle already in use |
39 | File handle requires write or append mode |
3A | File handle requires read mode |
60 | An EFC event/interrupt has occurred |