Jump to content

Search the Community

Showing results for tags 'C character string'.



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

There are no results to display.


Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Location


Interests


Sparkfun


Github

Found 1 result

  1. 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.
×