Hi all,
I am working on a data logger project using a uAlfat OEM SD card module.
I need to send data to it via the software serial library. The data must be sent as ASCII text exactly as written including spaces followed by a CR charachter for example O 0W>LOG1.TXT
This would create a new file called log1.txt, if sucessful the device would reply with !00.
It will be very useful to readback the response for error checking etc.
I can setup the port and have tried in vain with the software serial print command to send data, and followed various examples, but to no avail my device does not create files. If I send the same text exactly using a PC terminal emulator it does exactly as it should.
I am sure I am not formatting the data correctly and it is not being sent as ASCII data by the Arduino.
How do I do this please?
Hi,
The physical interface is a 2 wire logic level UART running at 9600, 8, N, 1 with no handshaking
This code should create a directory called testdir after 5 seconds.
#include <SoftwareSerial.h>
#define rxPin 2 // software Rx pin (connect to Tx on uAlfat)
#define txPin 3 // software Tx pin (connect to Rx on uAlfat)
// set up a new serial port
SoftwareSerial swSerial = SoftwareSerial(rxPin, txPin);
void setup() {
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
// set the data rate for the SoftwareSerial port
swSerial.begin(9600);
delay(5000);
swSerial.print("M TESTDIR \r");
}
void loop() {
}
Hi All!
Sucess, I have worked it out ;D
I can now communicate with my uAlfat module. The snippet of code below will create a test directory.
It does not have error handling yet, this is next along with a few other functions!
Once I have got proper error handling working I will post a "how to" so that others will be able to use this excellent and very powerful SD card module. The great thing is all the high level fat stuff is done on the board and no library is necessary, all is done by simple text commands. This saves tons of space for CODE!!! It also only uses 2 pins. A third will probably be required for the uAlfat reset line for clean operation.
#include <SoftwareSerial.h>
#define out_pin 3 //connect to uAlfat UART RX port #define in_pin 2 //connect to uAlfat UART TX port
SoftwareSerial uAlfat = SoftwareSerial(in_pin, out_pin);
Hello,
Thanks for the great information. I am actually attempting to do something similar for a school project. If you have any thing else to add please let me know and I will post my code as soon as it is finished.
RQ
Hello,
Thanks for the great information. I am actually attempting to do something similar for a school project. If you have any thing else to add please let me know and I will post my code as soon as it is finished.
RQ