-
Notifications
You must be signed in to change notification settings - Fork 39
Updated uart pad mapping #144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated uart pad mapping #144
Conversation
Not very well tested. (TX1 on Pad 10 does not work)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stephenf7072 Your changes look accurate from what I can tell.
I did some testing on my RedBoard ATP and on your branch was able to get SerialSF to appear and function correctly on pins 9 and 10 for RX and TX respectively. (See testing sketch below - based on yours)
Can you get it to work? Perhaps there is a hardware problem on your board?
Also, would you consider removing the comments about your changes? In my opinion it will be best to rely on the version control software to track exactly who made which changes to the codebase. You could / should also add your name to the ACKNOWLEDGEMENTS.md file to make sure you are listed as a contributor :)
/*
(based on) SerialPassthrough sketch
created 23 May 2016
by Erik Nyquist
*/
//Works on Nano board (Nano board selected as board in IDE)
//#define SerialSF Serial1
//#define SerialSF Serial
//Works on Nano board, with ATP selected as board in IDE
//Uart SerialSF(1, Nano10, Nano9);
//Works on Nano board, with ATP selected as board in IDE
//Uart SerialSF(1, Nano10, Nano16);
//Works!!! Using I2C3 port on my custom board, with Artemis ATP selected as board
//Uart SerialSF(1, 43, 42);
//Works!!! Using I2C3 port on Artemis Redboard board, with Artemis ATP selected as board
//Uart SerialSF(1, 43, 42);
//Doesn't work On Artemis Redboard board, with Artemis ATP selected as board
//Uart SerialSF(1, 10, 9);
//Works On Artemis Redboard board, with Artemis ATP selected as board
//Uart SerialSF(1, 25, 24);
//Works On Artemis Redboard board, with Artemis ATP selected as board
//Uart SerialSF(1, 40, 39);
//Works (after first core fix) On custom board, with Artemis ATP selected as board
//Uart SerialSF(1, 9, 42);
//Still doesn't work (after first core fix) On custom board, with Artemis ATP selected as board
//Uart SerialSF(1, 9, 10);
//Uart SerialSF(1, 40, 39); // pin 40 works for rx and 39 works for tx on UART1
//Uart SerialSF(1, 9, 39); // pin 9 seems to work for RX w/ 39 doing the transmitting
//Uart SerialSF(1, 40, 10); // pin 10 seems to work for TX w/ 40 doing the receiving
Uart SerialSF(1, 9, 10); // this worked for me too - though at first I thought it did not. May have had my wires crossed at first
void setup() {
// pinMode(peripheralsPowerPin, OUTPUT);
// digitalWrite(peripheralsPowerPin, LOW);
// Serial.begin(9600);
// SerialSF.begin(9600);
Serial.begin(115200);
SerialSF.begin(115200);
Serial.println("Starting Serial");
SerialSF.println("Starting SFSerial");
}
void loop() {
// SerialSF.print("Hello");
if (Serial.available()) { // If anything comes in Serial (USB),
SerialSF.write(Serial.read()); // read it and send it out SerialSF (pins 0 & 1)
}
if (SerialSF.available()) { // If anything comes in SerialSF (pins 0 & 1)
Serial.write(SerialSF.read()); // read it and send it out Serial (USB)
}
}
P.s. why 7072? At first I thought it might be a prime number but that did not check out. Unusual to be born on either the 0th month or day... Or maybe you prefer to leave it as a mystery!
contributions are tracked by commit history and contributors are acknowledged in the ACKNOWLEDGEMENTS.md file
@stephenf7072 Thanks a bunch, it looks good. I am going to go ahead and merge. Glad to have your support! |
Second opinions and testing/checking needed before merging
I had been trying to set Serial1 to work on pads (not pins) 9 (RX) and 10 (TX), and I narrowed it down to pad 10 not functioning as TX1. Assigning the port to other pins worked fine (test code below - uses an FTDI plugged into a separate COM port and viewed in Termite serial monitor).
I dug into the core code, found 4 omissions plus 2 typos and made (largely untested, although no compilation warnings/errors, and some basic UART combinations work ok) fixes to files:
I've double checked and fixed all the assignments for UART0 and UART1 against the pin mapping Table 559 of the Apollo3 Blue datasheet, and a pull request is pending. Couldn't quite bring myself to do the same for SPI/I2C/others at this stage.
Unfortunately, TX1 still doesn't work on pad 10, so I'm a bit stumped. Any ideas?
Test code (worked successfully on Nano, Redboard and my custom board, I really need to get an ATP for stuff like this though - remember if using pad numbers instead of pin numbers, to select board "Artemis ATP" and cross-reference the schematic for the pad numbers vs pin numbers):