al1fch 5 Posted December 23, 2012 Share Posted December 23, 2012 Hi I want to drive serial things (WiFi RN-171, BlueTooth module...) and keep serial through USB for Stellaris<-> PC connection. Is there yet a way to use Hardware Serial1 or SoftwareSerial with current Energia for Stellaris ? Quote Link to post Share on other sites
Rei Vilo 695 Posted December 23, 2012 Share Posted December 23, 2012 The StellarPad features many hardware serial ports. For more details, please refer to the pin map at http://forum.stellarisiti.com/topic/390-stellarpad-pins-assignment/ Quote Link to post Share on other sites
al1fch 5 Posted December 23, 2012 Author Share Posted December 23, 2012 Hi Rei Vilo Needing Rx(1) and Tx(1) (PB_0 and PB_1) I have tried "Serial1.begin(9600)" just as I do with Arduino Mega and Arduino Leonardo for alternate Uarts. Error message is : error: 'Serial1' was not declared in this scope -Is there any thing else to do with Energia for extra Uarts ? -Does current Energia supports Stellaris's multiple Uarts ? Quote Link to post Share on other sites
Rei Vilo 695 Posted December 24, 2012 Share Posted December 24, 2012 Use `selectModule()` as described in https://github.com/energia/Energia/blob/master/hardware/lm4f/cores/lm4f/HardwareSerial.cpp#L228 HardwareSerial mySerial; void setup() { mySerial.selectModule(3); mySerial.begin(9690); ... } The same logic applies for I2C and SPI. As an alternative, declare the variable as described in https://github.com/energia/Energia/blob/master/hardware/lm4f/cores/lm4f/HardwareSerial.cpp#L130 HardwareSerial Serial2(2); Quote Link to post Share on other sites
jcR 6 Posted January 5, 2013 Share Posted January 5, 2013 Hello the methodology described here does not really work. Indeed, the creation of different UARTS works correctly but the resultant binary gives no output signals on the UARTS that have been created. If we reduce the program to a single uart, it does not work either unless you removed the call .selectModule (0-6). see example: HardwareSerial serial1; HardwareSerial serial2; void setup() { serial1.selectModule(0); serial1.begin(9600); serial2.selectModule(1); serial2.begin(9600); } void loop() { serial1.write("Hello"); serial2.write("Hello"); } No compiation errors but binary execution on stellaris give no output signal on TX 0 or 1. I monitor the signal with an logic analyser on all TX pins . if serial1.selectModule(0) and serial2.selectModule(1) are removed the UART 0 is ok Any ideas JC Ragris Quote Link to post Share on other sites
Rei Vilo 695 Posted January 6, 2013 Share Posted January 6, 2013 Please open an issue at http://github.com/energia/Energia/issues Quote Link to post Share on other sites
jcR 6 Posted January 7, 2013 Share Posted January 7, 2013 Hi It's the same problem described on issue #165 14 day Ago. I wait ! Thanks JC Quote Link to post Share on other sites
energia 485 Posted February 16, 2013 Share Posted February 16, 2013 This has been fixe with commit https://github.com/energia/Energia/commit/b156c7f0a04c1cd38494d564621e51ddaa495bfe Quote Link to post Share on other sites
pici 0 Posted March 21, 2013 Share Posted March 21, 2013 (edited) Does anybody has a working example for uart1 ? Sounds stupid, but i tried this - no success. #include "Energia.h" void setup() { Serial1.begin(9600); } void loop() { Serial1.println("abcdefghijklmnopq"); delay(1000); } I connected J1-3 and J1-4 to buspirate to check for uart output - shows nothing. regards Mike Edited March 21, 2013 by bluehash Please use code tags next time. Welcome to Stellarisiti! Quote Link to post Share on other sites
pici 0 Posted March 21, 2013 Share Posted March 21, 2013 ok found tx signal with my dso on PC5. According to TI Data sheet this should be uart4. Quote Link to post Share on other sites
BRey1426459911 0 Posted April 11, 2013 Share Posted April 11, 2013 I also found Serial1 on PC_5 & PC_6. The oft referred (and beautiful) Pin diagram: https://github.com/energia/Energia/wiki/Hardware shows RX(1) & TX(1) on both PC_5,PC_6 and on PB_0,PB_1 (pins 3,4). The Launchpad User Manual also shows U1 on pins 3 & 4. I haven't been able to get any data out on these pins and I don't see any reference in HardwareSerial.cpp; is it possible to get Serial on PB_0,PB_1? Quote Link to post Share on other sites
reaper7 67 Posted April 11, 2013 Share Posted April 11, 2013 .... is it possible to get Serial on PB_0,PB_1? of course This will be needed in the future for WizFi Boosterpack library (maybe this weekend...) diff for latest GitHub HardwareSerial.cpp: 95c95 < {GPIO_PA0_U0RX, GPIO_PA1_U0TX}, {GPIO_PC4_U1RX, GPIO_PC5_U1TX}, --- > {GPIO_PA0_U0RX, GPIO_PA1_U0TX}, {GPIO_PB0_U1RX, GPIO_PB1_U1TX}, 103c103 < GPIO_PORTA_BASE, GPIO_PORTC_BASE, GPIO_PORTD_BASE, GPIO_PORTC_BASE, --- > GPIO_PORTA_BASE, GPIO_PORTB_BASE, GPIO_PORTD_BASE, GPIO_PORTC_BASE, 109c109 < // The list of i2c gpio configurations. --- > // The list of UART gpio configurations. 114c114 < GPIO_PIN_0 | GPIO_PIN_1, GPIO_PIN_4 | GPIO_PIN_5, --- > GPIO_PIN_0 | GPIO_PIN_1, GPIO_PIN_0 | GPIO_PIN_1, HardwareSerial.cpp.diff.7z Quote Link to post Share on other sites
pici 0 Posted April 12, 2013 Share Posted April 12, 2013 It's me again - still have problems withe uarts. TX/RX from Stellarpad are connected to TX/RX from FTDI USB-Serial Device. I can only receive chars from Stellar but when i try to send some back, nothing is received. To make it clear UART-TX from Stellar works fine but no UART-RX. Tested with following code: HardwareSerial mySerial(3); void setup() { unsigned char c = 0; //mySerial.selectModule(3); mySerial.begin(9600); mySerial.println("Test starts ... "); while( c != 'U') { c = mySerial.read(); delay(200); mySerial.print(c); } } void loop() { } I checked it with Serial 1 on PC_4 and PC_5 and with Serial 3 on PC_6 and PC_7. Oh and i updated the lm4 part of the lib 2 weeks ago and my HardWareSerail.cpp looks like the one on github. Any hints ? Quote Link to post Share on other sites
reaper7 67 Posted April 12, 2013 Share Posted April 12, 2013 @pici check this one (without HardwareSerial mySerial(3); ): void setup() { unsigned char c = 0; Serial3.begin(9600); Serial3.println("Test starts ... "); while( c != 'U') { if (Serial3.available()) { c = Serial3.read(); delay(200); Serial3.print(c); } } } void loop() { } Quote Link to post Share on other sites
pici 0 Posted April 12, 2013 Share Posted April 12, 2013 @reaper7 Yeap ! Works fine now. The available() call is also very helpfull - don't know how i could oversee this . Anyway thanks for your help !!! Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.