Difference between revisions of "SD Loader"
Blwikiadmin (talk | contribs) (→Cards) |
Blwikiadmin (talk | contribs) (→Cards) |
||
Line 30: | Line 30: | ||
* Optional Level Shifter mounted on [[GRID49]] card | * Optional Level Shifter mounted on [[GRID49]] card | ||
** Used for legacy 5V system targets | ** Used for legacy 5V system targets | ||
+ | * Optional [[Mini360_Adapter_Board]] Wide-range input Power card | ||
=== QT Py Breakout Card === | === QT Py Breakout Card === |
Revision as of 14:51, 6 June 2022
Contents
Introduction
Legacy computer systems typically load and save programs over serial ports. This is often done by attaching a PC and running a terminal program to send/receive programs to the legacy systems. Integrating modern storage, like SD cards, can be a serious challenge into legacy designs.
Replacing the external PC offers the opportunity to more easily transport the system. A compact solution that emulates the PC for transfers would be useful.
This design transfers files to/from an SD card via a serial port. It runs a menu driven program on small OLED to control transfers and supports SD cards up to 32GB (FAT32 formatted). The serial interface has RTS/CTS hardware handshake support. It can run with 5V or 3.3V target systems or at RS-232 levels. Custom cards could easily be added to emulate cassette interfaces or run.
Features
- Supports SD cards up to 32GB
- FAT32 formatted
- Serial interface
- Full hardware Handshake support
Cards
- Constructed out of existing Land Boards cards
- QT Py board
- Either the SAMD board or RP2040 board versions
- QT Py Breakout board or QTPy49
- SD CARD X49
- MyMenu
- MCP23008 I2C interface
- OLED
- 5 Pushbuttons
- 3 LEDs
- Optional RS-232 Level Translator
- DCE or DTE cards
- Optional Level Shifter mounted on GRID49 card
- Used for legacy 5V system targets
- Optional Mini360_Adapter_Board Wide-range input Power card
QT Py Breakout Card
- Power via USB C cable
QTPy49 Card
SD CARD X49
MyMenu
RS-232 Level Shifter (Optional)
Level Shifter (Optional)
- Use for "legacy" 5V Serial target systems
- Not used for 3.3V systems
- Convert 3.3V QT Py Tx/Rx/RTS/CTS to "legacy" 5V
- Built on GRID49 card
- Adafruit 4-channel I2C-safe Bi-directional Logic Level Converter
QT Py Breakout Card (on GRID49 card) Cabling
- QT Py uses (2) 1x7 male headers for signals
- Cut off 1 set of holes of (2) female housings to make 1x7 female headers
- SD Card uses (1) 1x8 header
- MyMenu uses (1) 1x5 header
- QT Py uses 2x8 header for 3.3V and Ground
- Use 2x3 female housings
- 40mm cables to Host Target
QT Py Breakout Card to MyMenu Cabling
QT Py | SIGNAL | MyMenu | COLOR |
---|---|---|---|
1 (A0) | INT(D6) | P2-5 | GRY |
5 (SDA) | SDA | P2-3 | WHT |
6 (SCL) | SCL | P2-4 | BRN |
GND | GND | P2-1 | BLK |
VCC | +3.3V | P2-2 | RED |
QT Py Breakout Card to SD_CARD_X49 Cabling
QT Py | SIGNAL | SD_CARD_X49 | COLOR |
---|---|---|---|
03 (A3) | SS* | J1-5 | GRY |
09 (SCK) | SCK | J1-3 | BLU |
10 (MI) | MISO | J1-2 | BRN |
11 (MO) | MOSI | J1-4 | WHT |
GND | GND | J1-1 | BLK |
VCC | 3.3V | J1-8 | RED |
QT Py Breakout Card to Host Serial
QT Py | SIGNAL | COLOR |
---|---|---|
GND | GND | BLK |
7 (TX) | TX | WHT |
8 (RX) | RX | BRN |
2 (A1) | RTS* | GRY |
3 (A2) | CTS* | ORA |
QTPy49 Card Cabling
- QT Py Card has function specific headers
QTPy49 Card to MyMenu Cabling
QTPy49 | SIGNAL | MyMenu | COLOR |
---|---|---|---|
J5-1 | GND | P2-1 | BLK |
J5-2 | +3.3V | P2-2 | RED |
J5-3 | SDA | P2-3 | WHT |
J5-4 | SCL | P2-4 | BRN |
J9-3 | INT(AD0) | P2-5 | GRY |
QTPy49 Card to SD_CARD_X49 Cabling
QT Py | SIGNAL | SD_CARD_X49 | COLOR |
---|---|---|---|
J3-1 | GND | J1-1 | BLK |
J3-2 | 3.3V | J1-8 | RED |
J3-4 (MO) | MOSI | J1-4 | WHT |
J3-5 (MI) | MISO | J1-2 | BRN |
J3-6 (SCK) | SCK | J1-3 | BLU |
J6-3 (A3) | SS* | J1-5 | GRY |
QTPy49 Card to Host Serial
QTPy49 | SIGNAL | COLOR |
---|---|---|
J8-3 (AD1) | RTS* | GRY |
J7-1 (AD2) | CTS* | ORA |
J4-4 (RX) | RX | BRN |
J4-3 (TX) | TX | WHT |
J4-2 (VCC) | +3.3V | Xlator (only) |
J4-1 (GND) | GND | BLK |
Software
- Runs on Arduino Nano
Human Interface Design (HID)
- Menu driven
- OLED display
SD Card
- Library
- Example files
SD Card Library
- SD Card library
- The SD library allows for reading from and writing to SD cards, e.g. on the Arduino Ethernet Shield
- Based on sdfatlib
- The library supports FAT16 and FAT32 file systems on standard SD cards and SDHC cards
- It uses short 8.3 names for files
- The file names passed to the SD library functions can include paths separated by forward-slashes, /, e.g. “directory/filename.txt”
- Because the working directory is always the root of the SD card, a name refers to the same file whether or not it includes a leading slash (e.g. “/file.txt” is equivalent to “file.txt”)
- As of version 1.0, the library supports opening multiple files.
- The communication between the microcontroller and the SD card uses SPI, which takes place on digital pins 11, 12, and 13 (on most Arduino boards) or 50, 51, and 52 (Arduino Mega)
- Additionally, another pin must be used to select the SD card
- This can be the hardware SS pin - pin 10 (on most Arduino boards) or pin 53 (on the Mega) - or another pin specified in the call to SD.begin()
SD Card Example Code
- SD Card example Code
- Read and Write File example
- Read Card Information
- Read a file from a SD card using the SD library and send it over the serial port
- Create and destroy a file on a SD card
- List the files available in the directory of the SD card
SD Card Connections
** SCLK - CLK - pin 13 ** MISO - SDI - pin 12 ** MOSI - SDO - pin 11 ** SS - CS - depends on your SD card shield or module.
Serial
- Serial Reference
- Serial.begin(speed)
- Serial.available()
- Get the number of bytes (characters) available for reading from the serial port.
- This is data that’s already arrived and stored in the serial receive buffer (which holds 64 bytes).
- Turn off/on receive handshake based on Serial.available() count and storage
- Serial.write()
- Writes binary data to the serial port
- This data is sent as a byte or series of bytes
- To send the characters representing the digits of a number use the print() function instead.
- Syntax
Serial.write(val) Serial.write(str) Serial.write(buf, len)