Search the Community

Showing results for tags 'serial'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • News
    • Announcements
    • Suggestions
    • New users say Hi!
  • Spotlight!
    • Sponsor Spotlight
    • Sponsor Giveaways
  • Energia
    • Energia - MSP
    • Energia - TivaC/CC3XXX
    • Energia - C2000
    • Energia Libraries
  • MSP Technical Forums
    • General
    • Compilers and IDEs
    • Development Kits
    • Programmers and Debuggers
    • Code vault
    • Projects
    • Booster Packs
    • Energia
  • Tiva-C, Hercules, CCXXXX ARM Technical Forums
    • General
    • SensorTag
    • Tiva-C, Hercules, CC3XXX Launchpad Booster Packs
    • Code Vault
    • Projects
    • Compilers and IDEs
    • Development Kits and Custom Boards
  • Beagle ARM Cortex A8 Technical Forums
    • General
    • Code Snippets and Scripts
    • Cases, Capes and Plugin Boards
    • Projects
  • General Electronics Forum
    • General Electronics
    • Other Microcontrollers
  • Connect
    • Embedded Systems/Test Equipment Deals
    • Buy, Trade and Sell
    • The 43oh Store
    • Community Projects
    • Fireside Chat
  • C2000 Technical Forums
    • General
    • Development Kits
    • Code Vault
    • Projects
    • BoosterPacks

Calendars

  • Community Calendar

Found 39 results

  1. So, Indeed YELLOW_LED controls the red LED on the board. 8^) But I still can't get serial on my Mac to work reliably. I have set the baud to 115200 (Launchpad and Energia Terminal). I have tried Serial and Serial1. I have tried both usbmodems that show up, I do have USB 3.0, but I have no control over that. I have also tried the macOSX screen command which turns a terminal session into a serial console. The kicker is, one time I *did* get serial output to show up using this method. I was printing to Serial and Serial1 at the time. So I modified it to do one or the other but never again got any joy. One frustrating thing is that once I try something, I have to unplug and re-plug the USB to prevent "resource already in use" errors. Any thoughts?
  2. Hi all, I'm using MSP432 with energia. I'm getting weird symbols in the serial monitor instead of the values sent through the Serial.print() function.I have seen these happening when the baud rate specified in code and serial monitor is not same, but this is happening when they are same.Please see the attached image and provide help.
  3. Hello guys, I have been trying to connect my MSP432R Launchpad with another device that requires 57600 bps on Serial1 and after hours trying to find an error in my code I decided to test the Serial1 port. Thus I uploaded the following test code and connected RX to TX (P3.2 <-> P3.3) : void setup() { Serial.begin(115200); Serial1.begin(115200); Serial.println("Starting..."); } void loop() { Serial1.write('A'); if (Serial1.available()) { int inByte = Serial1.read(); Serial.write(inByte); } delay(1000); } So far everything works as expected. Then I try the same code but with Serial1.begin(57600) but it won't work, I won't get any data from the Serial1 port. (I tried several other rates and it seems that only 9600bps and 115200bps were working correctly). Anyone knows about this issue ? Thanks in advance. PS : Even the back channel UART to computer Serial.begin(57600) seems broken
  4. Hi, I am trying to make a UART connection with a device from serial1 in MSP432. It isn't working as i cannot see anything printing on my serial monitor (I am trying to print the data stored in global variables using serial/USB). Wherein the same code works fine on MSP430 or TM4C1294 devices. I have double checked my wiring connections.. P3.2, P3.3 for RX, TX. Can anyone here help me resolve this issue or point out where im going wrong.. Please find the code below //----------------------------------------------------------------------------- // Microchip MCP39F501 Power Monitor TI Interface Sample Code #define ACK 0x06 #define NACK 0x15 #define CSFAIL 0x51 int OK1_Count = 0; // Success/No Success Counter for Reg Read 0x0002 int NOK1_Count = 0; byte Xmit_Dly = 2; // Transmit Delay between bytes, in msec byte Header; // Received ACK/NACK/CSFAIL byte byte Byte_Count; // Reveived Byte count byte CurrentRMS_LL; // 0x0004 CurrentRMS byte CurrentRMS_L; // 0x0005 CurrentRMS byte CurrentRMS_H; // 0x0006 CurrentRMS byte CurrentRMS_HH; // 0x0007 CurrentRMS byte VoltageRMS_L; // 0x0008 Voltage RMS byte VoltageRMS_H; // 0x0009 Voltage RMS byte ActivePower_LL; // 0x000A ActivePower byte ActivePower_L; // 0x000B ActivePower byte ActivePower_H; // 0x000C ActivePower byte ActivePower_HH; // 0x000D ActivePower byte ReactivePower_LL; // 0x000E ReactivePower byte ReactivePower_L; // 0x000F ReactivePower byte ReactivePower_H; // 0x0010 ReactivePower byte ReactivePower_HH; // 0x0011 ReactivePower byte ApparentPower_LL; // 0x0012 ApparentPower byte ApparentPower_L; // 0x0013 ApparentPower byte ApparentPower_H; // 0x0014 ApparentPower byte ApparentPower_HH; // 0x0015 ApparentPower byte PowerFactor_L; // 0x0016 PowerFactor byte PowerFactor_H; // 0x0017 PowerFactor byte Freq_L; // 0x0016 Frequency byte Freq_H; // 0x0017 Frequency byte CheckSum; byte CalculatedCS; float CurrentRMS; // Current RMS float VoltageRMS; // Voltage RMS float ActivePower; // Active Power float ReactivePower; // Reactive Power float ApparentPower; // Apparent Power float PowerFactor; // Power Factor float Freq; // Frequency void setup() { Serial.begin(9600); Serial.println("Entering Loop "); } void loop() { if (RegRead0x0004()) { OK1_Count++; } else { NOK1_Count++; } Serial.println("------------------------------------------"); Serial.print("MCP39F501 DEMO BOARD : "); Serial.println("------------------------------------------"); Serial.println("OUTPUTS"); Serial.print("RMS Current : "); Serial.print(CurrentRMS*0.0001,4); Serial.println(" A"); Serial.print("RMS Voltage : "); Serial.print(VoltageRMS*0.1,1); Serial.println(" V"); Serial.println("DATA COMMUNICATION"); Serial.print("1st frame counts: OK="); Serial.print(OK1_Count,DEC); Serial.print(", Not OK="); Serial.println(NOK1_Count,DEC); delay(1000); } bool RegRead0x0004(void) { Serial1.begin(4800); WriteByte(0xA5); WriteByte(0x08); WriteByte(0x41); WriteByte((byte)0x00); WriteByte(0x04); WriteByte(0x4E); WriteByte(0x16); WriteByteND(0x56); ClearBuffer(); // Parse the data returned from the meter if (Serial1.available()) { Header = Serial1.read(); Byte_Count = Serial1.read(); CurrentRMS_LL = Serial1.read(); CurrentRMS_L = Serial1.read(); CurrentRMS_H = Serial1.read(); CurrentRMS_HH = Serial1.read(); VoltageRMS_L = Serial1.read(); VoltageRMS_H = Serial1.read(); ActivePower_LL = Serial1.read(); ActivePower_L = Serial1.read(); ActivePower_H = Serial1.read(); ActivePower_HH = Serial1.read(); delay(50); ReactivePower_LL = Serial1.read(); ReactivePower_L = Serial1.read(); ReactivePower_H = Serial1.read(); ReactivePower_HH = Serial1.read(); ApparentPower_LL = Serial1.read(); ApparentPower_L = Serial1.read(); ApparentPower_H = Serial1.read(); ApparentPower_HH = Serial1.read(); PowerFactor_L = Serial1.read(); PowerFactor_H = Serial1.read(); Freq_L = Serial1.read(); Freq_H = Serial1.read(); CheckSum = Serial1.read(); } Serial1.end(); Serial.print("Cehcksum Received: "); Serial.println(CheckSum,HEX); // Calculate the expected CheckSum CalculatedCS = (byte)((int)( Header + Byte_Count + CurrentRMS_LL + CurrentRMS_L + CurrentRMS_H + CurrentRMS_HH + VoltageRMS_L + VoltageRMS_H + ActivePower_LL + ActivePower_L + ActivePower_H + ActivePower_HH + ReactivePower_LL + ReactivePower_L + ReactivePower_H + ReactivePower_HH + ApparentPower_LL + ApparentPower_L + ApparentPower_H + ApparentPower_HH + PowerFactor_L + PowerFactor_H + Freq_L + Freq_H + 0)%256); Serial.print("Checksum Calculated: "); Serial.println(CalculatedCS,HEX); // Check for ACK, correct byte count and CheckSum matches expected checksum if ((Header == 0x06) ){//&& (Byte_Count == 0xD) && (CheckSum == CalculatedCS)) { Serial.println("IM HERE"); CurrentRMS = ((unsigned long)(CurrentRMS_HH << 24) + (unsigned long)(CurrentRMS_H << 16) + (unsigned long)(CurrentRMS_L << 8) + (unsigned long)(CurrentRMS_LL)); VoltageRMS = ((unsigned int)(VoltageRMS_H << 8) + (unsigned int)(VoltageRMS_L)) ; return true; } else return false; } void WriteByte(byte _wbyte) { Serial1.flush(); Serial1.write(_wbyte); delay(Xmit_Dly); } void WriteByteND(byte _wbyte) { Serial1.flush(); Serial1.write(_wbyte); //delay(Xmit_Dly); } void ClearBuffer(void) { Serial1.flush(); while(Serial1.available()) char _f = Serial1.read(); delay(30); }
  5. Hi, I am using MSP432P401R to make a UART connection and talk to a board. I have found in the datasheet that MSP432 supports only one UART (RX-P3.2, TX-P3.3). In this case when I use serial to transmit and receive from the other board, Can there be a way i can view the data on serial monitor? How to realize this? I have read in other posts about software serial where GPIOs can be used as serial pins. Can someone brief it for me. My project basically is to read bytes from MCP39F501 onto MSP432P401R and then transmit that data using MODBUS TCP protocol with CC3100 boaster pack.
  6. Good morning. I've been using the MSP430 launchpad and programming it using Energia 18. Anyway, for the whole time I've been using Energia, it very often have to unplug and plug back in my device in order to send it another build. Have any of you seen this problem before? Sometimes it works without having to unplug the hardware, however, over 50% of the time, I have to unplug the LaunchPad in order to upload new code to it from Energia. It seems to get hung while attempting the upload. So, to overcome this, I unplug the Launchpad, click the Upload button again, usually get an error, so I click Upload again and then it seems to start working. Another problem I've been having is that half the time, the Serial Debug output window doesn't show any output. I usually have to close it and re-open it in order to see the output. Also, sometimes, it just doesn't show any output no matter how many times I close and re-open it. Is this just me, or is it a bit iffy with the debug window and the upload? I'm doing all this on a Windows 8 box and have the latest Energia 18 on it. Any ideas to make it so I don't have to keep on unplugging/plugging in my device with each upload? Thanks much, Curtis
  7. Is there a way to use the SoftwareSerial library on the Stellaris Launchpad TM4C123GXL board? I am trying to connect a Sparkfun serial enabled LCD screen to the board but the SoftwareSerial library is only compatible with 20, 16, and 8 MHz processors, and the TM4C123GXL is an 80 MHz chip. How can I use this LCD screen with the Stellaris Launchpad over a UART connection? Do I need to use SoftwareSerial or can I do without it? I am programming in Energia 0101E0017 on Windows 7 64 bit. Any help is greatly appreciated, thanks!
  8. Oh I hope someone can help me out of this headache. I run the msp430g2452 from my MAC (Yosemite), Ran fine after installing drives and all. Now suddenly the "Serial Port" has gone grey and I try to re install, reboot, re everything. No way I can connect again. I was playing with digital out and also in. Seemed like it was when I was trying to read the switch on pin5 that things went bad for me. I know many have had problems on a mac and I have looked intense on this Forum and other on the net. Now I try this. I hope someone can help. Greetings from Brazil and thanks any help. Peter
  9. Here's a tutorial on programming a graphical UI in Google Chrome to display data received over serial http://www.lucadentella.it/en/2016/06/07/chrome-app-e-comunicazione-seriale/ via Dangerous Prototypes. I meant looking into this topic for a long time. For serial communication like in this tutorial, but also USB for a portable upgrade application via a custom USB BSL implementation.
  10. 0down votefavorite Hi, I am trying to implement Modbus TCP on TIVA 1294 using the following code. I am using a modbus slave simulator on a pc to check the following code. However, the code doesn't seem to be working. I have downloaded the code & the libraries fromhttp://myarduinoprojects.com/modbus.html. Please suggest me corrections if necessary. Also is there another working example available for modbus tcp/ip for ethernet on TIVA energia? Please guide. #include <SPI.h> #include <Ethernet.h> #include "MgsModbus.h" MgsModbus Mb; int inByte = 0; // incoming serial byte // Ethernet settings (depending on MAC and Local network) byte mac[] = {0x00, 0x1A, 0xB6, 0x02, 0xD1, 0x14 }; IPAddress ip(192, 168, 0, 35); void setup() { // serial setup Serial.begin(9600); Serial.println("Serial interface started"); // initialize the ethernet device Ethernet.begin(mac, ip); // start etehrnet interface Serial.println("Ethernet interface started"); // print your local IP address: Serial.print("My IP address: "); for (byte thisByte = 0; thisByte < 4; thisByte++) { // print the value of each byte of the IP address: Serial.print(Ethernet.localIP()[thisByte], DEC); Serial.print("."); } Serial.println(); // slave address Mb.remSlaveIP = (192,168,0,1); // Fill MbData // Mb.SetBit(0,false); Mb.MbData[0] = 1; Mb.MbData[1] = 2; Mb.MbData[2] = 3; Mb.MbData[3] = 4; Mb.MbData[4] = 5; Mb.MbData[5] = 6; Mb.MbData[6] = 0; Mb.MbData[7] = 0; Mb.MbData[8] = 0; Mb.MbData[9] = 0; Mb.MbData[10] = 0; Mb.MbData[11] = 0; // print MbData for (int i=0;i<12;i++) { Serial.print("address: "); Serial.print(i); Serial.print("Data: "); Serial.println(Mb.MbData); } // print menu Serial.println("0 - print the first 12 words of the MbData space"); Serial.println("1 - FC 1 - read the first 5 coils from the slave and store them in the lower byte of MbData[1]"); Serial.println("2 - FC 2 - read the first 5 discrete inputs from the slave and store them in the higer of the MbData[1]"); Serial.println("3 - FC 3 - read the first 5 registers from the slave and store them in MbData[3..7"); Serial.println("4 - FC 4 - read the first 5 input registers from the slave and store them in MbData[8..12]"); Serial.println("5 - FC 5 - write coil 0 of the slave with the bit valeu of MbData[0.0]"); Serial.println("6 - FC 6 - write register 0 of the slave with MbData[2]"); Serial.println("7 - FC 15 - write 5 coils of the slave starting with coil 0 with GetBit(16..20"); Serial.println("8 - Fc 16 - write 5 registers of the slave starting on register 0 with MbData[0..4]"); Serial.println(Mb.remSlaveIP); } void loop() { if (Serial.available() > 0) { // get incoming byte: inByte = Serial.read(); if (inByte == '0') { // print MbData for (int i=0;i<12;i++) { Serial.print("address: "); Serial.print(i); Serial.print("Data: "); Serial.println(Mb.MbData); } } if (inByte == '1') {Mb.Req(MB_FC_READ_COILS, 6,6,6);} // 1 // ref, count, pos if (inByte == '2') {Mb.Req(MB_FC_READ_DISCRETE_INPUT, 6,6,6);} // 2 if (inByte == '3') {Mb.Req(MB_FC_READ_REGISTERS, 6,6,6);} // 3 if (inByte == '4') {Mb.Req(MB_FC_READ_INPUT_REGISTER, 6,6,6);} // 4 if (inByte == '5') {Mb.Req(MB_FC_WRITE_COIL, 0,0,0);} // 5 // count can be x if (inByte == '6') {Mb.Req(MB_FC_WRITE_REGISTER, 7,0,0);} // 6 // count can be x if (inByte == '7') {Mb.Req(MB_FC_WRITE_MULTIPLE_COILS, 0,6,0);} // 15 if (inByte == '8') {Mb.Req(MB_FC_WRITE_MULTIPLE_REGISTERS, 0,6,0);} // 16 } Mb.MbmRun(); // Mb.MbsRun(); } Thanks.
  11. I am planning to port this code for TIVA-C129 using Energia (on a Mac). 1st trying if it even compiles. I have below include #include "XBee.h" #include <SoftwareSerial.h> Getting error "#include <SoftwareSerial.h> ^ compilation terminated." I even tried doing #include "SoftwareSerial.h" but same error. What am I missing?
  12. I have an XBee (S2C) connected to my Mac and another XBee connected to a TI microcontroller (TIVA-C129) communicating with each other - Mac as a coordinator and TI as a router. I can communicate between them, but on the TI side, I can't read the exact data that is coming in the serial port. On the Mac, I am running below python code that reads the incoming serial data through XBee and writes an acknowledgment. #!/usr/bin/python import serial ser = serial.Serial('/dev/tty.usbserial-A104IC2U', 9600) ack='A' while True: incoming = ser.readline().strip() if incoming != 'A': print '%s' % incoming ser.write('%s\n' % ack) On the TI side, I have below code int incomingByte = 0; void setup() { Serial3.begin(9600); //UART3 has XBee connection pinMode(LED, OUTPUT); } void loop() { Serial3.println("Sending command to the XBee"); delay(1000); Serial3.println("I am R1"); delay(1000); if (Serial3.available() > 0) { // read the incoming byte from UART3 incomingByte = Serial3.read(); // say what you got, print at the usb serial console Serial.print("I received: "); Serial.println(incomingByte, DEC); } } When I run this, XBee communication stops after printing "I am R1" in the python console. I am sure Serial3.available() > 0 is working as when I replace it with a blink code like below, it works and XBee communication keeps working on. if (Serial3.available() > 0) { digitalWrite(LED, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(LED, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second } So looks like the problem is in incomingByte = Serial3.read(); From python, I am sending a string (%s) with ser.write('%s\n' % ack). Is Serial3.read() the right read mechanism for the ack string? Anything else? FYI: I tested the serial.read() only with TI (no python involved) by writing something in the console and serial.read() can read and print it.
  13. Since my only 5529LP was confirmed no longer functioning properly and the likely cause is the USB hub module, there have been some thoughts going through my mind to salvage the core 5529 device on the LP for some good use. And this weekend I have decided to give it a try. As the USB host part is confirmed not functioning, the first step is to verify the F5529 is still good. The easiest way is to try program it and check if it can run new program. With a good F5529 LP (the new replacement board ordered after the old one retired), I removed all the jumpers between the ez-FET and the target device, and then wired the GND, 5V, 3V3, RXD, TXD, SBW RST, and SBW TST from the good ez-FET to the 5529 side of the old LP. This will also power up the old board from the new one as the USB host on the old board is dead and no longer powering it. Soon after an example Energia sketch of SerialCallResponseASCII is uploaded through the new, good board, the good news is displayed on the Serial console confirming the 5529 device is still working flawlessly. At this point, I came into realization that this board can no longer be a handy development board as it once was but only good for deployment, possibly permanently, to some project because I have to rely on that good LP every time for programming. But wait, I recall recently from the forum there are some posts mentioning Forth interpreter for MSP430, one of which by monsonite with comprehensive information on various Forth offerings. However, a common requirement for Forth is serial communication for the console that my old LP is no longer capable to provide with a dead USB hub. Even though I don't have serial to usb converter to bypass the on-board hub for direct serial connection, I remember there is an old Arduino Pro Mini laying around without much used. Combining these two, I could probably build a utility development board that provide ad hoc programming capability (in Forth) on the 5529LP provide the console access required by Forth on the 5529LP via the Arduino Pro Mini (forward the serial communication from the Arduino UART to the 5529LP TX/RX) power the 5529LP via the 5V and 3V3 pin from the Arduino Pro Mini All in all, the goal is to take the Arduino Pro Mini as the controller or programmer of the 5529LP that is programmed to run Forth only. I picked the Mecrisp as it provided out of the box support for the 5529LP and pre-compiled hex file. So the build begin by first flashing the Forth hex file to the 5529LP. Again it required a good 5529LP and I used the latest MSPFlasher for the job. The following is the command line (for Windows). MSP430Flasher.exe -w "forth-mecrisp-5529.hex" -v -g -z [VCC] For a more decent looking of this utility development board, the Pro Mini is mounted to a medium sized breadboard on one end, and with four metal pins (pulled from left over connectors), the 5529LP is somehow "mounted" to the other end. This is enough for some structural support for the 5529LP Now for the Arduino side. Since there is only one set of UART on the Pro Mini, the program on it make use of the SoftSerial library that will emulate another serial port by two digital pins to relay the serial messages from the real UART to the 5529LP. Finally the moment of truth, the serial console to the Arduino is opened for a test. Apart from the line feed being weird, the expression run (1 2 + .<cr>) is successful, so is the programming of the blinky program Moving forward, the Arduino can be programmed in such a way that not only merely relaying serial message, but parse special commands to initiate specific Forth programming to the 5529LP (the Forth programs themselves stored as program in the Arduino). Hopefully this will make the whole package more versatile and practical.
  14. I have a Spikenzie Labs LCD screen with an interface (screen utilizes the HD44780 chipset). I have it connected to an MSP-EXP432P401R (Rev 1.0). I have finally got code working that allows me to write to the LCD screen through the serial monitor, however I can only write to the screen for a short but varying amount of time. Sometimes I can print to the screen for 5 seconds, sometimes only for 1 second before communication cuts out. Here is the code I am using: #include <Wire.h> #include <LiquidCrystal.h> #define addr 0x40 >> 1 void setup() { Wire.begin(); Serial.begin(9600); } void loop() { Wire.beginTransmission(addr); Wire.write(Serial.read()); Wire.endTransmission(); } My connections are as follows: LCD screen -> MSP432 VCC -> 5V GND -> GND SDA -> pin 10 SCL -> pin 9 I have also tried using a level shifting circuit on the data lines with no effect. Does anyone know what's going on and what I can do to fix this? Thank you
  15. Apologies in advance for a long post.... First, here is what I am trying to do: I have a MSP430F5529 LP with a dAISy backpack sending serial data at 38400 Baud to a Tiva C LP with a CC3100 backpack. The Tiva C can send debug information to a Windows 10 machine at 115200 Baud. I am using Energia v17. The Tiva C sends NMEA sentences received from dAISy through WiFi to the marinetraffic.com site where the information is posted along with other stations all over the world. If you aren't familiar with dAISy and AIS, here is a screen shot from marinetraffic of ships being tracked by my station: A quick diversion: dAISy works great! I was able to get it up and running easily in OpenCPN and for the most part on marinetraffic. Thanks to @@chicken for his help on understanding NEMA sentences (how the ship information is communicated) and a great product. The problem is occurring in my sketch which transmits the data to marinetraffic. The screenshot above comes from my original sketch where I used the String class to store incoming data from dAISy and then send it to marinetraffic. This works pretty good on the Tiva athough it seems to introduce rare errors. It introduces lots of errors if I try to use a F5529 with a CC3100. Thinking the problem was with String, I decided to use C style character arrays. Unfortunately by doing this I have introduced even more errors. An outline of the code I am using is shown below: /* Code to set up WiFi goes here... */ char nmea[100]; // holds incoming NMEA sentences from dAISy WiFiClient client; void setup() { Serial1.begin(38400); // dAISy transmits to CC3200 at 38400 baud // on Serial1 Serial.begin(115200); // Output from CC3200 to serial monitor is // at 115200 baud on Serial /* Code to get WiFi and Serial started goes here... Includes connections to network and to marinetraffic */ void loop() { /* If marinetraffic gets disconnected there is code to reconnect herre... */ int i = 0; // counter set to 0 each time through the loop while (Serial1.available()) { // look for incoming NMEA sentences from dAISy nmea[i] = (char)Serial1.read(); // place char into the array nmea[] Serial.print(nmea[i]); // debug print char by char as it is placed into nmea[] nmea[++i] = 0; // increment the counter and store a end of string marker if (nmea[i-1] == '\n') { // newline indicates the end of the NMEA sentence Serial.print(nmea); // print the entire sentence //client.print(nmea); // send the string to MarineTraffic // (error occurs even when commented out) } } } All the stuff where I have taken out code and replaced it with block comments seems to work. But you can see the complete code here. What this does is declare a char array named nmea and read data coming in byte by byte from dAISy. I print out for debugging each nmea element as it comes in on the serial monitor. A NMEA sentence uses a newline to indicate the end of the sentence. So when a sentence ends I debug print it out to the serial monitor also. Normally this is where the sentence would be sent to marinetraffic also. What is expected is that each sentence would then show on the serial monitor twice. Once when a char is read in, and once when the sentence is complete. That is what happens with String. But when I use a character array as shown above I get this kind of thing: A valid NMEA sentence starts with !AIVDM and you can see that every other sentence looks good. Those are coming from the print statement that does element by element of nmea as the data comes in from dAISy. So data from dAISy looks good and the character array seems to be loading correctly. The next line should look exactly the same. Sometimes it does, usually it does not. Notice that it will either be blank or have some portion of the end of the good sentence. I have ruled out something to do with the CC3100 I think by commenting that print line out. dAISy looks good. What am I doing wrong (I am just starting to use char arrays instead of String)? Or is it something to do with trying to read and write from Serial and Serial1 at the same time in Energia? BTW, I think the same thing may be happening with String although it really shows up bad only on the F5529.
  16. I'm trying to understand the two possible configurations of the headers on the MSP430G2, rev 1.5, at the top near the border between the emulator and the uart. The silk screen seems to indicate that one configuration is appropriate for hardware uart, and the other configuration is appropriate for software uart. I'm wondering, why does it matter? Whether using a software uart or chip with a hardware uart on board, either way doesn't the TX pin of the MSP still need to go to the RX pin of the emulator (likewise for RX-TX) in order to get data back and forth from a PC? And when the direction is rotated, this seems even stranger since it looks like we're connecting TX-TX and RX-RX. So what's really going on here? Thanks
  17. Hi, I wonder if it is possible to cause a interrupt when receiving serial data. This would have the big advantage to be able to wake up from sleep mode if new serial data is available. By now, serial data is written in the rx buffer even in sleep mode, but afaik it's not possible to notice that in Energia. I found lots of code for CCS for exactly this application, but i'm not able to port it for Energia. Does anybody already has some example code or may help me to make the CCS code working in Energia? Thanks!
  18. All, I have a gps device that outputs several other sensor readings (wind, heading, ect.). All of those strings are output in NMEA format strings. I am able to read these strings and also (with the TinyGPS library) I can parse them to pull what I need. Now the problem, I want to be able to send NMEA strings back at the device in order to tell it to output different NMEA string types. For example, sending "$PAMTC,EN,HDG" should enable the "$HCHDG" string on the device. Or sending "#PAMTC,QV" should query the software version number. My code to read from the device is: Code: [Select] void setup() { // put your setup code here, to run once: Serial.begin(4800); Serial1.begin(4800); } void loop() { // put your main code here, to run repeatedly: char c; c = Serial1.read(); Serial.print
  19. I've got an F5229LP app that sets SMCLK to XT2 with a divider of 4. (XT2 = 25Mhz crystal, which is also the source for MCLK) When I initialize the clocks, HardwareSerial no longer produces an accurate Baud Rate, and it breaks terminal communication. I see that HardwareSerial.cpp contains: #define SMCLK F_CPU //SMCLK = F_CPU for now I've tried changing it to F_CPU / 4 but the situation did not improve. Here is my recreation code: (Uncomment initClocks(25000000l); and change HardwareSerial.cpp to see it fail) #include <WString.h> void initClocks(uint32_t mclkFreq); void SerialTestText() { Serial.println("Back channel active."); char* selfTest = (char*) ("Performing Self Test."); while (*selfTest) Serial.print(*selfTest++); Serial.println(selfTest); } void setup() { // put your setup code here, to run once: // initClocks(25000000l); Serial.begin(115200); delay(10); //Turn on LED pinMode(RED_LED, OUTPUT); digitalWrite(RED_LED, true); Serial.println(' ');//Sacrificial character. (First character is often garbled.) SerialTestText(); } int _previous = 0; void loop() { // put your main code here, to run repeatedly: int _now = millis()/2000; digitalWrite(RED_LED, (int)(millis()/500) & 0x1); if (_previous != _now) SerialTestText(); _previous = _now; } void initClocks(uint32_t mclkFreq) { #ifdef __MSP430F5529__ //Enable XT2 P5SEL |= BIT3 + BIT2; UCSCTL6 &= ~XT2OFF; delay(100); //Give time for XT2 to settle // Assign the XT1 as the FLL reference clock UCSCTL3 &= ~0x7; UCSCTL3 |= 0x2;//FLL reference clock divider of 1 // Assign the XT2 as the MCLK reference clock UCSCTL4 &= ~0x7;//MCLK source bits UCSCTL4 |= 0x5;//Source = XT2 when available otherwise DCOCLKDIV UCSCTL5 &= ~0x7;//Clock divider of 1 (25Mhz) // Assign the XT2 as the SMCLK reference clock UCSCTL4 &= ~0x70; UCSCTL4 |= 0x50;//SMCLK UCSCTL5 &= ~0x70; UCSCTL5 |= 0x10; //Clock divider of 4 (6.25Mhz) // Assign the XT1 as the source for ACLK UCSCTL4 &= ~0x700; UCSCTL4 |= 0x100;//ACLK UCSCTL5 &= ~0x700; UCSCTL5 |= 0x100; //Clock divider of 16 (~4khz) #endif } How do I use HardwareSerial with a custom value of SMCLK?
  20. My eventual goal is to pass in NMEA GPS strings to our board and use them in our code. For now I am trying to connect a SparkFun venus GPS unit to a TI-MSP430FR5969 board (version 2.0). I am using the SoftwareSerial example: (https://github.com/energia/Energia/blob/master/hardware/msp430/libraries/SoftwareSerial/examples/SoftwareSerialExample/SoftwareSerialExample.ino) The error message when compiling is that the SoftwareSerial only supports 16MHz processors. My confussion is that the comments in the code make specific mention of having resolved this issue. Additionaly, if i understand correctly the MSP430fr5969 board is a 16MHz processor. I have already replaced the files in the softwareSerial library folder with the code from GitHub. (https://github.com/energia/Energia/tree/master/hardware/msp430/libraries/SoftwareSerial) The eventual goal will be to use a NMEA.h library with an Airmar wind sensor to receive GPS and other sensor readings. Could you assist me in solving this error message? Thank you.
  21. Hello, I am trying to have my MSP430G2553 on a launchpad (Rev.1.5) show anything on the serial monitor using the following code: void setup() { Serial.begin(9600); } void loop() { Serial.println("Test"); delay(1000); } I have downloaded the drivers http://energia.nu/Guide_Windows.html I have switched the jumpers http://energia.nu/img/LaunchPadMSP430G2553-V1.5.jpg I'm just not sure what is wrong. I can load the Blink example and get it to work and even making it do other things but when it comes to reading values and serial the launchpad doesn't want to do anything.
  22. I am having trouble getting an external serial GPS device (GY-GPS6MV2) to communicate with my CC3200. I have this pin mapping set-up and I have connected pin 3 on the CC3200 to the TX pin of the GPS device. I have uploaded code that should make a test light turn off if it is receiving data, but the light remains on unless I type into the serial monitor. #define LED RED_LED void setup() { pinMode(3, INPUT); pinMode(4, OUTPUT); Serial.begin(9600); pinMode(LED, OUTPUT); Serial.println("GPS Module"); } void loop() { if (Serial.available()) { digitalWrite(LED, LOW); delay(100); Serial.println((char)Serial.read()); } else { digitalWrite(LED, HIGH); } } Please help!
  23. Hi all, I have downloaded the energia sdk(version 13) for CC3200 launch pad, I have configured the jumper wire for J8 and SOP2 also the rest jumpers. Apart from that , I updates the firmware , so I have tries all possible ways, but still my serial monitor is not working. The platform is windows.
  24. ive compiled and uploaded my code (below) and when plug my msp430g2553 in it goes to the programmed angle it should when plugged in, but when i run the exe that is supposed to change its angle it doesnt do anything. the exe is programmed to connect to com4, and the msp430 application uart is set to com4. i know the exe can detect it because it wont run unless it can, it just isnt responding. im am using energia 0101E0010 to compile and upload. any help would be appreciated. here is the code: #include <Servo.h> Servo myServo; const int servoPin = 9; // the pin the servo is connected to int val = 0; // a value accumulated from data on the serial port int angle = 90; // the current angle of the servo void setup() { Serial.begin(9600); myServo.attach(servoPin); myServo.write(angle); // center the servo } void loop() { if ( Serial.available()) { char ch = Serial.read(); if(ch >= '0' && ch <= '9') // is ch a number? val = val * 10 + ch - '0'; // yes, accumulate the value else if(ch == '-') // is this the minus sign? { angle = angle - val; if(angle < 0) angle = 0; myServo.write(angle); // write the new angle val = 0; } else if(ch == '+') // is this the plus sign? { angle = angle + val; if(angle > 180) angle = 180; myServo.write(angle); // write the new angle val = 0; } } }
  25. I'm fairly new to specifically MSP430 development, so any help here is appreciated! I'm trying to send data to and from a Raspberry Pi connected over hardware UART. This I've tested and works. I'm also trying to run two servos on the MSP430 and the basic code I have for them has been tested and also works. The problem occurs when I try to put them together as my timer setup must clash somewhere. It seems to me that the serial communication is all set on TA0 while the other timer is set to TA1. I don't understand why this would prevent the UART from sending and receiving. Edit: I'm using the MSP430G2553 int main(void){ WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer init_servos(); init_UART(); _BIS_SR(GIE); // Enable CPU interrupts while(1){ // Wait for incoming character _BIS_SR(LPM0_bits); // Enter low poser mode if (rxBuffer == 'a') { P1OUT |= BIT0; } } } void init_UART() { DCOCTL = 0x00; // Set DCOCLK to 1MHz BCSCTL1 = CALBC1_1MHZ; DCOCTL = CALDCO_1MHZ; P1OUT = 0x00; // Initialize all GPIO P1SEL = UART_TXD + UART_RXD; // Timer function for TXD/RXD pins P1DIR = UART_TXD + BIT0; // TX and LED1 to Output // Configures Timer_A for full-duplex UART operation TA0CCTL0 = OUT; // Set TXD Idle as Mark = '1' TA0CCTL1 = SCS + CM1 + CAP + CCIE; // Sync, Neg Edge, Capture, Int TA0CTL = TASSEL_2 + MC_2; // SMCLK, start in continuous mode } void init_servos() { P2SEL |= BIT0 | BIT1; P2DIR |= BIT0 | BIT1; // Duty Cycle (585 - 675 - 765) TA1CCTL0 = OUTMOD_7; // reset/set (0) TA1CCTL1 = OUTMOD_7; // reset/set (1) TA1CTL = TASSEL_2 + MC_1; // SMCLK, up mode BCSCTL1 = 0x84; // CLK Info TA1CCR0 = 675; // Duty Cycle (2.0) TA1CCR1 = 675; // Duty Cycle (2.1) } void TimerA_UART_print(char *string) { // Prints a string using the Timer_A UART while (*string) TimerA_UART_tx(*string++); } void TimerA_UART_tx(unsigned char byte) { while (TACCTL0 & CCIE); // Ensure last char got TX'd TACCR0 = TAR; // Current state of TA counter TACCR0 += UART_TBIT; // One bit time till first bit TACCTL0 = OUTMOD0 + CCIE; // Set TXD on EQU0, Int txData = byte; // Load global variable txData |= 0x100; // Add mark stop bit to TXData txData <<= 1; // Add space start bit } #pragma vector = TIMER0_A0_VECTOR // Timer_A UART - Transmit Interrupt Handler __interrupt void Timer_A0_ISR(void) { static unsigned char txBitCnt = 10; TA0CCR0 += UART_TBIT; // Add Offset to CCRx if (txBitCnt == 0) { // All bits TXed? TA0CCTL0 &= ~CCIE; // All bits TXed, disable interrupt txBitCnt = 10; // Re-load bit counter } else { if (txData & 0x01) TA0CCTL0 &= ~OUTMOD2; // TX Mark '1' else TA0CCTL0 |= OUTMOD2; // TX Space '0' } txData >>= 1; // Shift right 1 bit txBitCnt--; } #pragma vector = TIMER0_A1_VECTOR // Timer_A UART - Receive Interrupt Handler __interrupt void Timer_A1_ISR(void) { static unsigned char rxBitCnt = 8; static unsigned char rxData = 0; switch (TA0IV) { // Use calculated branching case TA0IV_TACCR1: // TACCR1 CCIFG - UART RX TA0CCR1 += UART_TBIT; // Add Offset to CCRx if (TA0CCTL1 & CAP) { // Capture mode = start bit edge TA0CCTL1 &= ~CAP; // Switch capture to compare mode TA0CCR1 += UART_TBIT_DIV_2; // Point CCRx to middle of D0 } else { rxData >>= 1; if (TA0CCTL1 & SCCI) // Get bit waiting in receive latch rxData |= 0x80; rxBitCnt--; if (rxBitCnt == 0) { // All bits RXed? rxBuffer = rxData; // Store in global variable rxBitCnt = 8; // Re-load bit counter TA0CCTL1 |= CAP; // Switch compare to capture mode _BIC_SR_IRQ(LPM0_bits); // wake up from low power mode. } } break; } }