alest704 0 Posted October 22, 2017 Share Posted October 22, 2017 Hello, I am currently working on a project that involves the MSP430F5529LP in conjunction with the Ultimate GPS Breakout module. Right now I using SoftwareSerial in order to read the input from the sensor. The issue that I am having is that the SoftwareSerial library only works with 16MHz processors. Since my MCU runs at 25MHz. I wanted to know if there is a way to make the MCU run at 16MHz. Attached to this post is the code that I currently have running, and the error that I keep getting. Quote Link to post Share on other sites
dubnet 238 Posted October 22, 2017 Share Posted October 22, 2017 First of all, welcome to the forum. If I remember correctly, the software serial library isn't supported on the F5529, only on the lower end G2 parts without built in hardware serial. However, it shouldn't be needed as the 5529 has two hardware serial ports. The second serial port would be referred to as Serial1 (e.g. "Serial1.begin" as opposed to the first serial port "Serial.begin"). Refer to the pin outs on energia.nu for the correct pins for each port. Fmilburn and NurseBob 2 Quote Link to post Share on other sites
NurseBob 111 Posted October 23, 2017 Share Posted October 23, 2017 Hi @dubnet, The problem he's having, which I also ran into, is the Tiny GPS++ code is built on top of the software serial library for the arduino. I got around it with Energia 17, which offered the option of running the mcu at either 16MHz or 25MHz. So, Energia 17 and the 16MHz option compiles for me. I can't find a similar option in the board library for Enegia 18. Ultimately, I imported all the code into CCS to manage some of the other devices I'd attached... But being an imported Energia 17 project, it pulled in the 16MHz clock setting. Quote Link to post Share on other sites
NurseBob 111 Posted October 23, 2017 Share Posted October 23, 2017 Of course, as I look at the code now, I see that the simple solution would be to use Serial and, as you note, attach to the correct pins (P3.3,P3.4). I built my system before Energia 18... Time to go back and refactor!!! I went and looked at my current code: It uses Serial... dubnet 1 Quote Link to post Share on other sites
NurseBob 111 Posted October 23, 2017 Share Posted October 23, 2017 A quick test confirms that replacing SoftwareSerial with Serial compiles with both versions of Energia. Fmilburn 1 Quote Link to post Share on other sites
alest704 0 Posted October 23, 2017 Author Share Posted October 23, 2017 21 hours ago, NurseBob said: A quick test confirms that replacing SoftwareSerial with Serial compiles with both versions of Energia. I tried that but it gives me the following error. Could you tell me what .h file you included with your code to run the Serial function. Quote Link to post Share on other sites
NurseBob 111 Posted October 23, 2017 Share Posted October 23, 2017 Including SoftwareSerial is a problem... It's referencing the wrong Class. Quote Link to post Share on other sites
NurseBob 111 Posted October 23, 2017 Share Posted October 23, 2017 @alest704 Here's my headers and code through to setup() As mentioned before, remove your include statement for SoftwareSerial and all should be OK. HTH Bob #include <TinyGPS++.h> #include <IridiumSBD.h> #include <Adafruit_GFX.h> // Core graphics library #include <SPI.h> // this is needed for display #include <Adafruit_ILI9341.h> #include <Wire.h> // this is needed for FT6206 #include <Adafruit_FT6206.h> #include <stdio.h> #define DEBUG_CONSOLE volatile int iState; //iState determines switch/case handler for main loop volatile int nextState; static const uint16_t ledPin = P1_0; static const uint16_t GPS_PowerEnablePin = P6_5; static const uint16_t Iridium_SleepPin = P3_7; static const uint16_t sensorPin = P6_1; // select the input pin for the potentiometer static const uint16_t groundPin = P6_2; //MSP430F5529 pins for the LCD SPI controller static const uint16_t TFT_MOSI = P3_0; static const uint16_t TFT_CLK = P3_2; static const uint16_t TFT_MISO = P3_1; static const uint16_t TFT_RST = 0; //None //Add for ILI9341 controller static const uint16_t TFT_DC = P2_3; static const uint16_t TFT_CS = P2_6; static const int LCD_BACKLIGHT = P2_0; static const uint16_t GPSBaud = 9600; static const uint16_t SBDBaud = 19200; #define BEACON_MODE 0 #define SHOW_SYS_STATUS 1 #define SHOW_STOCK_MESSAGES 2 #define SHOW_MAIN_MENU 3 #define SLEEP_MODE 4 #define CANCEL_BEACON_MODE 5 static const uint16_t DISPLAY_MAIN_MENU = 0; static const uint16_t DISPLAY_STOCK_MSG_MENU = 1; String strMessageToSend = ""; String strLatitude = ""; String strLongitude = ""; String strGMTDate = ""; String strGMT = ""; String strPDT = ""; String strPDTDate = ""; String strGoogleMapURL ="<a href=\"https://www.google.com/#q=%2B"; String strGoogleMapLink = "\"> Google Map </a> "; //String strBobIsHere = "start:[ptitle \"On the John Muir Trail\"]"; String strBobIsHere = "start:[ptitle \"On the road\"]"; String strDate = ""; String strHour = ""; String strMinute = ""; String strSecond= ""; static String strStockMsg00 ="Camping as planned - all is well"; static String strStockMsg01 ="Camping here - short of goal but OK - moving slower"; static String strStockMsg02 ="STOPPED HERE - NEED HELP"; static String strStockMsg03 = "Main Menu"; float fCurrentBatteryVoltage = 0.0; float const fLowBattery = 3.66; float const fDeadBattery = 3.0; uint16_t sensorValue = 0; // variable to store the value coming from the sensor uint16_t batteryTextColor = ILI9341_GREEN; static bool gpsData = false; static bool messageSent = false; static uint16_t lcdMode; Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC); static uint16_t rotation = 1; static uint16_t leftMargin = 5; static int16_t rowStepPixels = 60; static uint16_t box_width = 240; static uint16_t box_height = 60; int textRowOffset = box_height/2 + 10; // The TinyGPS++ object TinyGPSPlus *gps; IridiumSBD isbd(Serial1, Iridium_SleepPin); Adafruit_FT6206 ctp = Adafruit_FT6206(); void InitPortsForLowPower(void); void InitGPS(void); bool ISBDCallback(); bool getGPS_Location_Date_Time(void); bool sendSBD_message(void); bool drawMainMenu(void); void wakeUp(void); void setIstate(int mode); void assembleMsgToSend(void); void cancelBeacon(void); bool drawMessageMenu(void); void getBatteryVoltage(void); //#define DEBUG_CONSOLE 1 void setup() { //getBatteryVoltage(); InitPortsForLowPower(); P1DIR &= ~(BIT4 | BIT6); pinMode(groundPin, OUTPUT); pinMode(sensorPin, INPUT); //pinMode(GREEN_LED, OUTPUT); // sets the digital pin as output pinMode(Iridium_SleepPin,OUTPUT); //Setup the enable/sleep pin for the RockBlock pinMode(LCD_BACKLIGHT, OUTPUT); digitalWrite(LCD_BACKLIGHT, HIGH); //turn on N-mosfet to turn off the LCD Backlight (connects to ground) #ifdef DEBUG_CONSOLE Serial.begin(115200); #endif InitGPS(); tft.begin(); if (! ctp.begin(40)) { // pass in 'sensitivity' coefficient #ifdef DEBUG_CONSOLE Serial.println("Couldn't start FT6206 touchscreen controller"); #endif while (1); } #ifdef DEBUG_CONSOLE Serial.println("Adafruit_FT6206()"); #endif pinMode(P2_7,INPUT_PULLUP); iState = SHOW_MAIN_MENU;//start with LCD active for UI } 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.