Jump to content

Kazz

Members
  • Content Count

    16
  • Joined

  • Last visited

About Kazz

  • Rank
    Member

Profile Information

  • Gender
    Male
  • Location
    Toronto, ON
  • Sparkfun
    http://sfe.io/w50978

Recent Profile Visitors

413 profile views
  1. Hello, I am attempting to run an Arduino project on on of my TI boards. I have a Maxim 1-Wire demo board that uses an Arduino for as its platform, not having one I decided to try a TI board. I load the required Libraries but I get an interesting issue. Even though there are two OneWire and I point it to the one I want to use it only finds some header files and not others. I have tried pointing to teh needed files with exact paths with no luck. To be sure I tried complaining teh same project in the Arduino IDE and there are no issues at all, include the needed libraries and it compiles. If someone could help explain what I am missing and why it finds some library files and not others that would be great. Thanks Kas C:\Users\Kas\Desktop\energia-1.6.10E18\arduino-builder -dump-prefs -logger=machine -hardware "C:\Users\Kas\Desktop\energia-1.6.10E18\hardware" -hardware "C:\Users\Kas\AppData\Local\Energia15\packages" -tools "C:\Users\Kas\Desktop\energia-1.6.10E18\tools-builder" -tools "C:\Users\Kas\Desktop\energia-1.6.10E18\hardware\tools\msp430" -tools "C:\Users\Kas\AppData\Local\Energia15\packages" -built-in-libraries "C:\Users\Kas\Desktop\energia-1.6.10E18\libraries" -libraries "C:\Users\Kas\Documents\Energia\libraries" -fqbn=energia:msp430:MSP-EXP430F5529LP -ide-version=10610 -build-path "C:\Users\Kas\AppData\Local\Temp\builda12a5302e2fbcba7b0882b591878e19b.tmp" -warnings=default -prefs=build.warn_data_percentage=75 -verbose "C:\Users\Kas\AppData\Local\Temp\arduino_modified_sketch_976722\MAXREFDES131_GUI_Firmware.ino" C:\Users\Kas\Desktop\energia-1.6.10E18\arduino-builder -compile -logger=machine -hardware "C:\Users\Kas\Desktop\energia-1.6.10E18\hardware" -hardware "C:\Users\Kas\AppData\Local\Energia15\packages" -tools "C:\Users\Kas\Desktop\energia-1.6.10E18\tools-builder" -tools "C:\Users\Kas\Desktop\energia-1.6.10E18\hardware\tools\msp430" -tools "C:\Users\Kas\AppData\Local\Energia15\packages" -built-in-libraries "C:\Users\Kas\Desktop\energia-1.6.10E18\libraries" -libraries "C:\Users\Kas\Documents\Energia\libraries" -fqbn=energia:msp430:MSP-EXP430F5529LP -ide-version=10610 -build-path "C:\Users\Kas\AppData\Local\Temp\builda12a5302e2fbcba7b0882b591878e19b.tmp" -warnings=default -prefs=build.warn_data_percentage=75 -verbose "C:\Users\Kas\AppData\Local\Temp\arduino_modified_sketch_976722\MAXREFDES131_GUI_Firmware.ino" Using board 'MSP-EXP430F5529LP' from platform in folder: C:\Users\Kas\Desktop\energia-1.6.10E18\hardware\energia\msp430 Using core 'msp430' from platform in folder: C:\Users\Kas\Desktop\energia-1.6.10E18\hardware\energia\msp430 Detecting libraries used... "C:\Users\Kas\Desktop\energia-1.6.10E18\hardware\tools\msp430/bin/msp430-g++" -c -g -O2 -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -w -x c++ -E -CC -mmcu=msp430f5529 -DF_CPU=16000000L -DARDUINO=10610 -DENERGIA=10610 -DENERGIA_MSP-EXP430F5529LP -DENERGIA_ARCH_MSP430 -IC:\Users\Kas\Desktop\energia-1.6.10E18\hardware\tools\msp430/include "-IC:\Users\Kas\Desktop\energia-1.6.10E18\hardware\energia\msp430\cores\msp430" "-IC:\Users\Kas\Desktop\energia-1.6.10E18\hardware\energia\msp430\variants\MSP-EXP430F5529LP" "C:\Users\Kas\AppData\Local\Temp\builda12a5302e2fbcba7b0882b591878e19b.tmp\sketch\MAXREFDES131_GUI_Firmware.ino.cpp" -o "nul" "C:\Users\Kas\Desktop\energia-1.6.10E18\hardware\tools\msp430/bin/msp430-g++" -c -g -O2 -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -w -x c++ -E -CC -mmcu=msp430f5529 -DF_CPU=16000000L -DARDUINO=10610 -DENERGIA=10610 -DENERGIA_MSP-EXP430F5529LP -DENERGIA_ARCH_MSP430 -IC:\Users\Kas\Desktop\energia-1.6.10E18\hardware\tools\msp430/include "-IC:\Users\Kas\Desktop\energia-1.6.10E18\hardware\energia\msp430\cores\msp430" "-IC:\Users\Kas\Desktop\energia-1.6.10E18\hardware\energia\msp430\variants\MSP-EXP430F5529LP" "C:\Users\Kas\AppData\Local\Temp\builda12a5302e2fbcba7b0882b591878e19b.tmp\sketch\MAXREFDES131_GUI_Firmware.ino.cpp" -o "nul" Generating function prototypes... "C:\Users\Kas\Desktop\energia-1.6.10E18\hardware\tools\msp430/bin/msp430-g++" -c -g -O2 -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -w -x c++ -E -CC -mmcu=msp430f5529 -DF_CPU=16000000L -DARDUINO=10610 -DENERGIA=10610 -DENERGIA_MSP-EXP430F5529LP -DENERGIA_ARCH_MSP430 -IC:\Users\Kas\Desktop\energia-1.6.10E18\hardware\tools\msp430/include "-IC:\Users\Kas\Desktop\energia-1.6.10E18\hardware\energia\msp430\cores\msp430" "-IC:\Users\Kas\Desktop\energia-1.6.10E18\hardware\energia\msp430\variants\MSP-EXP430F5529LP" "C:\Users\Kas\AppData\Local\Temp\builda12a5302e2fbcba7b0882b591878e19b.tmp\sketch\MAXREFDES131_GUI_Firmware.ino.cpp" -o "C:\Users\Kas\AppData\Local\Temp\builda12a5302e2fbcba7b0882b591878e19b.tmp\preproc\ctags_target_for_gcc_minus_e.cpp" In file included from C:\Users\Kas\Documents\Energia\libraries\OneWire-master\src\OneWire.h:37:0, from C:\Users\Kas\AppData\Local\Temp\arduino_modified_sketch_976722\MAXREFDES131_GUI_Firmware.ino:40: C:\Users\Kas\Documents\Energia\libraries\OneWire-master\src\/Masters/Masters.h:38:42: fatal error: Masters/DS248x/DS2484/DS2484.h: No such file or directory compilation terminated. exit status 1 Error compiling for board MSP-EXP430F5529LP.
  2. I have updated the original post to better explain the issue (not to much added realy) and to include my full code. The conclusions I have reached without further testing is either the MSP430FR5969 or the CC3100BP used in that setup are faulty, hardware issue. Or that the the code generated for the MSP430FR5969 WiFi has some form of issue with it, software issue. Since I have not anything regarding a WiFi issue for the MSP430FR5969 I will start with my hardware setup when I get a chance. Currently I am behind in my projects that need to be completed so if there is no update feel free to poke me for one. Thanks Kas
  3. Hello, I am working on project that involves uploading data to an M2X server approximately 8 times per second (different streams) but I am having an issue. I constantly lose connection after 5 data uploads. I have used the M2X-Button_Press demo to test the issue on an MSP430FR5969 but NOT on an MSP430F5529 with. The response code I get is first -2 then followed by -1. I can reset the MSP430FR5969 and the system works again for ~5 iterations only to stop working again. My full code is posted below and after fully testing it works on an MSP430F5529 with seemingly no issue other than the time delay between sending posts out (~1 second per post). Thankfully Kas /* Multple serial test Receives from the MCP39F511 on Serial1 port, sends to the others. Receives from serial port 1, sends to the main serial (Serial 0). The circuit: * MCP39F511 RX and TX connected to Serial1 * Serial monitor open on Serial port 0: created 7 September 2016 by Kasriel Lewis adapted from code created by: Tom Igoe - MultiSerial (Energia Demo) Mark Easley - M2X-Button_Press (M2X Demo) This example code is in the public domain. */ #include <aJSON.h> #include "SPI.h" #include "WiFi.h" #include "M2XStreamClient.h" #include "WiFi_Credentials.h" #define ACK 0x06 #define NACK 0x15 #define CSFAIL 0x51 //DEBUG DEFINES #define debug 0 #define debugState 1 #define debugVerbose 0 #define debugStateThree 1 #define debugHEX 0 #define debugDEC 0 #define debugDOUBLE 0 byte requestData[] = {0xA5, 0x08, 0x41, 0x00, 0x02, 0x4E, 0x1C, 0x5A}; int timeSlot = 300; //Lowest 200 unsigned long time0 = 0; unsigned long time1 = 0; int receiveCounter = 0; int bytesToReceive = -1; unsigned char reveivedData[50]; //Input array int i = 0; int state = 0; unsigned char inChar; unsigned char checksum; double tempOutput; int diconnectCounter; int response; int deviceReadFrequency = 10000; double valuesToPush[7]; int availableBytes = 0; //DEBUG VARIABLES int outputCounter = 0; unsigned int tempUInt_16; unsigned long tempUInt_32; WiFiClient client; M2XStreamClient m2xClient(&client, m2xKey); void setup() { // initialize both serial ports: Serial.begin(115200); Serial1.begin(115200); // attempt to connect to Wifi network: Serial.print("Attempting to connect to Network named: "); // print the network name (SSID); Serial.println(ssid); // Connect to WPA/WPA2 network. Change this line if using open or WEP network: WiFi.begin(ssid, pass); while ( WiFi.status() != WL_CONNECTED) { // print dots while we wait to connect Serial.print("."); delay(300); } Serial.println("\nYou're connected to the network"); Serial.println("Waiting for an ip address"); while (WiFi.localIP() == INADDR_NONE) { // print dots while we wait for an ip addresss Serial.print("."); delay(300); } Serial.println("\nIP Address obtained"); // you're connected now, so print out the status printWifiStatus(); // prints title with ending line break Serial.println("\n\n\rRead Data from MCP39F511"); } void loop() { //send read data command to MCP39F511 time1 = millis(); switch(state){ case 0: Serial.flush(); if((time1 - time0) >= deviceReadFrequency){ for(i = 0; i < sizeof(requestData); i++){ Serial1.write(requestData[i]); delayMicroseconds(timeSlot); } time0 = millis(); #if debugState Serial.println("0 Send Command"); #endif state++; } break; case 1: availableBytes = Serial1.available(); if(availableBytes > 0){ inChar = (char)Serial1.read(); if(inChar == ACK){ reveivedData[receiveCounter] = inChar; checksum = inChar; receiveCounter++; state++; #if debug Serial.print("1 Receive first byte"); Serial.print(" - inChar "); Serial.print(inChar, HEX); Serial.print(" - receiveCounter "); Serial.print(receiveCounter, HEX); Serial.print(" - state "); Serial.print(state, DEC); Serial.print(" - availableBytes "); Serial.println(availableBytes, DEC); #endif } else if(inChar == NACK){ //Output error message Serial.println("Frame received with success command not understood or another error in command bytes"); state--; } else if(inChar == CSFAIL){ //Output error message Serial.println("Frame received with success, however, checksum did not match bytes in frame"); state--; } else{ state--; } } else{ if(diconnectCounter >= 10){ state = 0; diconnectCounter = 0; } } diconnectCounter++; #if debugState Serial.println("State #1"); #endif break; case 2: diconnectCounter = 0; availableBytes = Serial1.available(); if(availableBytes > 0){ inChar = (char)Serial1.read(); reveivedData[receiveCounter] = inChar; bytesToReceive = inChar; checksum += inChar; receiveCounter++; state++; #if debug Serial.print("2 Receive number of bytes to receive"); Serial.print(" - inChar "); Serial.print(inChar, HEX); Serial.print(" - receiveCounter "); Serial.print(receiveCounter, HEX); Serial.print(" - bytesToReceive "); Serial.print(bytesToReceive, DEC); Serial.print(" - state "); Serial.print(state, DEC); Serial.print(" - availableBytes "); Serial.println(availableBytes, DEC); #endif } #if debugState Serial.println("State #2"); #endif break; case 3: availableBytes = Serial1.available(); if(availableBytes > 0){ inChar = (char)Serial1.read(); reveivedData[receiveCounter] = inChar; receiveCounter++; if(receiveCounter < bytesToReceive){ checksum += inChar; } if(receiveCounter == bytesToReceive){ state++; #if debugState Serial.println("State #3 -> #4"); #endif } #if debug Serial.print("3 Receive remaining bytes"); Serial.print(" - inChar "); Serial.print(inChar, HEX); Serial.print(" - receiveCounter "); Serial.print(receiveCounter, HEX); Serial.print(" - bytesToReceive "); Serial.print(bytesToReceive, DEC); Serial.print(" - state "); Serial.print(state, DEC); Serial.print(" - availableBytes "); Serial.println(availableBytes, DEC); #endif } #if debugStateThree Serial.println("State #3"); #endif break; case 4: // timeService.getTimestamp32(timeStamp); if(checksum == reveivedData[30]){ tempOutput = (reveivedData[7] << 8) | reveivedData[6]; valuesToPush[1] = tempOutput; response = m2xClient.updateStreamValue(deviceId, streamName1, (tempOutput / 10)); Serial.print("\n\rVoltage RMS = "); Serial.println(response); tempOutput = 0x0000FFFF & (reveivedData[9] << 8) | reveivedData[8]; valuesToPush[3] = tempOutput; response = m2xClient.updateStreamValue(deviceId, streamName3, (tempOutput / 1000)); Serial.print("\n\rLine Frequency = "); Serial.println(response); tempOutput = 0x0000FFFF & ((reveivedData[13] << 8) | reveivedData[12]); valuesToPush[7] = tempOutput; response = m2xClient.updateStreamValue(deviceId, streamName7, (tempOutput * 3051757813) / 100000000000000); Serial.print("\n\rPower Factor = ");//TODO: This is a signed number, this needs to betaken into account Serial.println(response); tempOutput = (reveivedData[17] << 24) | (reveivedData[16] << 16) | (reveivedData[15] << 8) | reveivedData[14]; valuesToPush[2] = tempOutput; response = m2xClient.updateStreamValue(deviceId, streamName2, (tempOutput / 10000)); Serial.print("\n\rCurent RMS = "); Serial.println(response); tempOutput = (reveivedData[21] << 24) | (reveivedData[20] << 16) | (reveivedData[19] << 8) | reveivedData[18]; valuesToPush[4] = tempOutput; response = m2xClient.updateStreamValue(deviceId, streamName4, (tempOutput / 100)); Serial.print("\n\rActive Power = "); Serial.println(response); tempOutput = (reveivedData[25] << 24) | (reveivedData[24] << 16) | (reveivedData[23] << 8) | reveivedData[22]; valuesToPush[5] = tempOutput; response = m2xClient.updateStreamValue(deviceId, streamName5, (tempOutput / 100)); Serial.print("\n\rReactive Power = "); Serial.println(response); tempOutput = (reveivedData[29] << 24) | (reveivedData[28] << 16) | (reveivedData[27] << 8) | reveivedData[26]; valuesToPush[6] = tempOutput; response = m2xClient.updateStreamValue(deviceId, streamName6, (tempOutput / 100)); Serial.print("\n\rApparent Power = "); Serial.println(response); } #if debugDEC Serial.print("\n\rNumber of Bytes - "); Serial.print(reveivedData[1], DEC); Serial.print("\n\rSystem Status - 0x"); Serial.print(reveivedData[3], HEX); Serial.print(reveivedData[2], HEX); Serial.print("\n\rSystem Version - Year-20"); Serial.print(((reveivedData[5] & 0xF0) >> 4), DEC); Serial.print(" Month-"); Serial.print((reveivedData[5] & 0x0F), DEC); Serial.print(" Day-"); Serial.print(reveivedData[4], DEC); Serial.print("\n\rVoltage RMS = "); tempUInt_16 = (reveivedData[7] << 8) | reveivedData[6]; Serial.print((tempUInt_16 / 10), DEC); Serial.print("."); Serial.print((tempUInt_16 % 10), DEC); Serial.print("\n\rLine Frequency = "); tempUInt_16 = (reveivedData[9] << 8) | reveivedData[8]; Serial.print((tempUInt_16 / 1000), DEC); Serial.print("."); Serial.print((tempUInt_16 % 1000), DEC); Serial.print("\n\rAnalog Input Voltage = "); tempUInt_16 = (reveivedData[11] << 8) | reveivedData[10]; Serial.print(tempUInt_16, DEC); Serial.print("\n\rPower Factor = "); tempUInt_32 = 0x0000FFFF & ((reveivedData[13] << 8) | reveivedData[12]); Serial.print("0."); Serial.print(tempUInt_32 * 3051, DEC); Serial.print("\n\rCurent RMS = "); tempUInt_32 = (reveivedData[17] << 24) | (reveivedData[16] << 16) | (reveivedData[15] << 8) | reveivedData[14]; Serial.print((tempUInt_32 / 1000), DEC); Serial.print("."); Serial.print((tempUInt_32 % 1000), DEC); Serial.print("\n\rActive Power = "); tempUInt_32 = (reveivedData[21] << 24) | (reveivedData[20] << 16) | (reveivedData[19] << 8) | reveivedData[18]; Serial.print((tempUInt_32 / 100), DEC); Serial.print("."); Serial.print((tempUInt_32 % 100), DEC); Serial.print("\n\rReactive Power = "); tempUInt_32 = (reveivedData[25] << 24) | (reveivedData[24] << 16) | (reveivedData[23] << 8) | reveivedData[22]; Serial.print((tempUInt_32 / 100), DEC); Serial.print("."); Serial.print((tempUInt_32 % 100), DEC); Serial.print("\n\rApparent Power = "); tempUInt_32 = (reveivedData[29] << 24) | (reveivedData[28] << 16) | (reveivedData[27] << 8) | reveivedData[26]; Serial.print((tempUInt_32 / 100), DEC); Serial.print("."); Serial.print((tempUInt_32 % 100), DEC); Serial.print("\n\rChecksum Value Reveived = 0x"); Serial.print(reveivedData[30], HEX); Serial.print("\n\rChecksum Value Calculated = 0x"); Serial.println(checksum, HEX); #endif #if debugHEX Serial.print("ACK - 0x"); Serial.print(reveivedData[0], HEX); Serial.print("\n\rNumber of Bytes - 0x"); Serial.print(reveivedData[1], HEX); Serial.print("\n\rSystem Status - 0x"); Serial.print(reveivedData[3], HEX); Serial.print(reveivedData[2], HEX); Serial.print("\n\rSystem Version - 0x"); Serial.print(reveivedData[5], HEX); Serial.print(reveivedData[4], HEX); Serial.print("\n\rVoltage RMS x 10 = 0x"); Serial.print(reveivedData[7], HEX); Serial.print(reveivedData[6], HEX); Serial.print("\n\rLine Frequency x 1000 = 0x"); Serial.print(reveivedData[9], HEX); Serial.print(reveivedData[8], HEX); Serial.print("\n\rAnalog Input Voltage = 0x"); Serial.print(reveivedData[11], HEX); Serial.print(reveivedData[10], HEX); Serial.print("\n\rPower Factor / 2^(-15) = 0x"); Serial.print(reveivedData[13], HEX); Serial.print(reveivedData[12], HEX); Serial.print("\n\rCurent RMS x 1000 = 0x"); Serial.print(reveivedData[17], HEX); Serial.print(reveivedData[16], HEX); Serial.print(reveivedData[15], HEX); Serial.print(reveivedData[14], HEX); Serial.print("\n\rActive Power x 100 = 0x"); Serial.print(reveivedData[21], HEX); Serial.print(reveivedData[20], HEX); Serial.print(reveivedData[19], HEX); Serial.print(reveivedData[18], HEX); Serial.print("\n\rReactive Power x 100 = 0x"); Serial.print(reveivedData[25], HEX); Serial.print(reveivedData[24], HEX); Serial.print(reveivedData[23], HEX); Serial.print(reveivedData[22], HEX); Serial.print("\n\rApparent Power x 100 = 0x"); Serial.print(reveivedData[29], HEX); Serial.print(reveivedData[28], HEX); Serial.print(reveivedData[27], HEX); Serial.print(reveivedData[26], HEX); Serial.print("\n\rChecksum Value Reveived = 0x"); Serial.print(reveivedData[30], HEX); Serial.print("\n\rChecksum Value Calculated = 0x"); Serial.println(checksum, HEX); #endif #if debugDOUBLE Serial.print("\n\rNumber of Bytes - "); Serial.print(reveivedData[1], DEC); Serial.print("\n\rSystem Status - 0x"); Serial.print(reveivedData[3], HEX); Serial.print(reveivedData[2], HEX); Serial.print("\n\rSystem Version - Year-20"); Serial.print(((reveivedData[5] & 0xF0) >> 4), DEC); Serial.print(" Month-"); Serial.print((reveivedData[5] & 0x0F), DEC); Serial.print(" Day-"); Serial.print(reveivedData[4], DEC); Serial.print("\n\rVoltage RMS = "); tempOutput = (reveivedData[7] << 8) | reveivedData[6]; Serial.print((tempOutput / 10), 4); Serial.print("\n\rLine Frequency = "); tempOutput = 0x0000FFFF & (reveivedData[9] << 8) | reveivedData[8]; Serial.print((tempOutput/ 1000), DEC); Serial.print("\n\rAnalog Input Voltage = "); tempUInt_16 = (reveivedData[11] << 8) | reveivedData[10]; Serial.print(tempUInt_16, 4); Serial.print("\n\rPower Factor = ");//TODO: This is a signed number, this needs to betaken into account tempOutput = 0x0000FFFF & ((reveivedData[13] << 8) | reveivedData[12]); Serial.print((tempOutput * 3051757813) / 100000000000000, 4); Serial.print("\n\rCurent RMS = "); tempOutput = (reveivedData[17] << 24) | (reveivedData[16] << 16) | (reveivedData[15] << 8) | reveivedData[14]; Serial.print((tempOutput / 10000), 4); Serial.print("\n\rActive Power = "); tempOutput = (reveivedData[21] << 24) | (reveivedData[20] << 16) | (reveivedData[19] << 8) | reveivedData[18]; Serial.print((tempOutput / 100), 4); Serial.print("\n\rReactive Power = "); tempOutput = (reveivedData[25] << 24) | (reveivedData[24] << 16) | (reveivedData[23] << 8) | reveivedData[22]; Serial.print((tempOutput / 100), DEC); Serial.print("\n\rApparent Power = "); tempOutput = (reveivedData[29] << 24) | (reveivedData[28] << 16) | (reveivedData[27] << 8) | reveivedData[26]; Serial.print((tempOutput / 100), DEC); Serial.print("\n\rChecksum Value Reveived = 0x"); Serial.print(reveivedData[30], HEX); Serial.print("\n\rChecksum Value Calculated = 0x"); Serial.println(checksum, HEX); #endif #if debugVerbose for(outputCounter = 0; outputCounter < receiveCounter; outputCounter++){ Serial.print(reveivedData[outputCounter], HEX); Serial.print(" - outputCounter "); Serial.print(outputCounter, DEC); Serial.print(" - receiveCounter "); Serial.println(receiveCounter, HEX); } #endif receiveCounter = 0; state = 0; #if debugState Serial.println("State #4"); #endif break; // default : // break; } } void printWifiStatus() { // print the SSID of the network you're attached to: Serial.print("SSID: "); Serial.println(WiFi.SSID()); // print your WiFi shield's IP address: IPAddress ip = WiFi.localIP(); Serial.print("IP Address: "); Serial.println(ip); }
  4. The answer I found in my last post. Thanks to peteroakes? suggestion of trying less than 16 bytes I was able to see that the receiveCounter value a bit clearer. If you look in the last picture in teh above post the counter counts up to 0xA but there are never more than 5 bytes in the packet. This led me to realize the counter was not being reset and as such the once the first set of data was received the condition to ignore receiving more data was always true. As of this writing the program has been pulling data over serial for almost 3 hours even though its only been 5 bytes and not the 35 or so I will hopefully get working later. Kas
  5. I have now reduced the amount of data requested to see if there is anyway the buffer is the issue. The code was changed to request TWO bytes of data. For this there are a total of FIVE bytes returned (header, number of bytes, data[2] and checksum). This would allow for a lot of space in the buffer and should prevent any issues. 0xA5 - 0x40 is the data sent to the MCP39F511 0x06 - 0x0B is the data returned to the MSP430 Data packet sequence that is sent and returned to and from the MCP39F511 As can be seen from the above image this did not resolve the issue (debugState = 1). The program still hangs after receiving the first data received from the MCP39F511. All debugs have been disabled. With debug = 1 the program still stops after the first iteration, it starts teh second but teh program does not continue.
  6. I just increased the buffer size in "energia-1.6.10E18\hardware\energia\msp430\cores\msp430\HardwareSerial.cpp" to 32, 128 and 256. In all cases the results were the same. Looking at the second line of the compile output "Global variables use..." I can see that when the buffer is set to 16 bytes only about 4% is used but when I change it to 256 it jumps to 58% and if I try 512 I run out of ram. I would conclude the buffer size is increasing but testing this on both a MSP430FR5969 an MSP430F5529 have given me teh same results. The reality is I'm only using Energia because M2X has a library that yo can use without needing an RTOS or other OS. If I could use their C library without needing a RTOS I would happily do so. I may look at other IoT cloud services again to see if I can find another easy to use one that will allow for native C to be used. Kas
  7. Hello @B@tto, , Thank you for the reply, there are two things that make me think it's may not be a buffer issue. Firstly I only have an issue when the debug is enabled between lines 145 and 159. If the only output is "state #3" there is a critical issue where the system goes into an infinite loop. But, if I enable other debugs and not "State #3" I get less of an issue. The other reason I dont belive it to be a buffer issue is the comment for Serial.available(): available() Description Get the number of bytes (characters) available for reading from the serial port. This is data that
  8. Hello @@B@tto, A ) the data sent from the MCP39F511 can not be changed, it is set in the IC and I have to deal with it as it comes. I therefore can not look for any special chars. I do know how many bytes to receive and I am using that but there appears to be an issue with that. A delay in my opinion is bad programing practice and something I would never do if I was using C. Also there does not seem to be an issue if there is no output through the backchannel, at least for the first time through the state machine. The biggest issue is with sending out state 3 that appears to put the system in an infinite loop. b ) According the Energia reference page the Serial buffer is 128 bytes long: (Get the number of bytes (characters) available for reading from the serial port. This is data that
  9. Hello @Mention, I am using the MSP430FR5969 but do to the issues I was going to try it on the MSP430F5529 if this is of any help let me know. I have a few Launchpads that I could potentially test this code on if that helps you in anyway. Thanks Kas
  10. Hello All, I am attempting to use Energia (I know it's not Arduino but they are pretty much the same) to read data from a serial device that has some interesting quirks. The first issue I'm having is when using the debug code (debug = 1) the program only captures a portion of the serial data from the external device. /* Multple serial test Receives from the main serial port, sends to the others. Receives from serial port 1, sends to the main serial (Serial 0). The circuit: * Any serial device attached to Serial port 1 * Serial monitor open on Serial port 0: created 30 Dec. 2008 by Tom Igoe This example code is in the public domain. */ #define ACK 0x06 #define NACK 0x15 #define CSFAIL 0x51 #define debug 0 #define debugState 1 #define debugStateThree 1 byte requestData[] = {0xA5, 0x08, 0x41, 0x00, 0x3E, 0x4E, 0x20, 0x9A}; int timeSlot = 200; unsigned long time0 = 0; unsigned long time1 = 0; int receiveCounter = 0; int bytesToReceive = -1; char reveivedData[50]; //Input array boolean stringComplete = false; // whether the string is complete int outputCounter = 0; int i = 0; int state = 0; char inChar; int availableBytes = 0; void setup() { // initialize both serial ports: Serial.begin(115200); Serial1.begin(115200); // reserve 200 bytes for the inputString: // inputString.reserve(200); // prints title with ending line break Serial.println("Read Data from MCP39F511"); } void loop() { //send read data command to MCP39F511 time1 = millis(); switch(state){ case 0: if((time1 - time0) >= 1000){ for(i = 0; i < sizeof(requestData); i++){ Serial1.write(requestData[i]); delayMicroseconds(timeSlot); } time0 = millis(); #if debugState Serial.println("0 Send Command"); #endif state++; } break; case 1: availableBytes = Serial1.available(); if(availableBytes > 0){ inChar = (char)Serial1.read(); if(inChar == ACK){ reveivedData[receiveCounter] = inChar; receiveCounter++; state++; #if debug Serial.print("1 Receive first byte"); Serial.print(" - inChar "); Serial.print(inChar, HEX); Serial.print(" - receiveCounter "); Serial.print(receiveCounter, HEX); Serial.print(" - state "); Serial.print(state, DEC); Serial.print(" - availableBytes "); Serial.println(availableBytes, DEC); #endif } else if(inChar == NACK){ //Output error message Serial.println("Command received with success command not understood or another error in command bytes"); } else if(inChar == CSFAIL){ //Output error message Serial.println("Frame received with success, however, checksum did not match bytes in frame"); } } #if debugState Serial.println("State #1"); #endif break; case 2: availableBytes = Serial1.available(); if(availableBytes > 0){ inChar = (char)Serial1.read(); reveivedData[receiveCounter] = inChar; bytesToReceive = inChar; receiveCounter++; state++; #if debug Serial.print("2 Receive number of bytes to receive"); Serial.print(" - inChar "); Serial.print(inChar, HEX); Serial.print(" - receiveCounter "); Serial.print(receiveCounter, HEX); Serial.print(" - bytesToReceive "); Serial.print(bytesToReceive, DEC); Serial.print(" - state "); Serial.print(state, DEC); Serial.print(" - availableBytes "); Serial.println(availableBytes, DEC); #endif } #if debugState Serial.println("State #2"); #endif break; case 3: availableBytes = Serial1.available(); if(availableBytes > 0){ inChar = (char)Serial1.read(); reveivedData[receiveCounter] = inChar; receiveCounter++; if(receiveCounter == bytesToReceive){ state++; #if debugState Serial.println("State #3 -> #4"); #endif } #if debug Serial.print("3 Receive remaining bytes"); Serial.print(" - inChar "); Serial.print(inChar, HEX); Serial.print(" - receiveCounter "); Serial.print(receiveCounter, HEX); Serial.print(" - bytesToReceive "); Serial.print(bytesToReceive, DEC); Serial.print(" - state "); Serial.print(state, DEC); Serial.print(" - availableBytes "); Serial.println(availableBytes, DEC); #endif } #if debugStateThree Serial.println("State #3"); #endif break; case 4: for(outputCounter = 0; outputCounter < receiveCounter; outputCounter++){ Serial.print(reveivedData[outputCounter], HEX); Serial.print(" - outputCounter "); Serial.print(outputCounter, DEC); Serial.print(" - receiveCounter "); Serial.println(receiveCounter, HEX); } state = 0; #if debugState Serial.println("State #4"); #endif break; // default : // break; } } /* SerialEvent occurs whenever a new data comes in the hardware serial RX. This routine is run between each time loop() runs, so using delay inside loop can delay response. Multiple bytes of data may be available. */ // void serialEvent() { // while (Serial1.available()) { // Serial.println("9 Serial Data Avialable - SerialEvent"); // // get the new byte: // char inChar = (char)Serial1.read(); // if(receiveCounter == 1){ // bytesToReceive = inChar; // Serial.println("A Number of Bytes to Receive - "); // } // // add it to the inputString: // // inputString += inChar; //TODO: Remove // reveivedData[receiveCounter] = inChar; // Serial.println("B Input Data Read - "); // // if the incoming character is a newline, set a flag // // so the main loop can do something about it: // if ((bytesToReceive - 1) == receiveCounter) { // stringComplete = true; // Serial.println("C Completed Input Data Read - "); // } // receiveCounter++; // Serial.println("D End of SerialEvent"); // } // } The device returns 35 bytes but the MSP430 device only sees 16 of them. When I turn off debug (debug = 0) but still output the states (except for state 3) the output looks a lot more acceptable but only runs once. It starts to receive the second set of data but stops at state 3. Once debugStateThree is enabled things really stop working. If left this ends up being an infinite loop. The data format from the MCP39F511 is a bit odd in that the baud rate is set to 115200 yet the data cannot be sent continuously at that clock speed without breaks, notice the time delay in the send portion of the code, delayMicroseconds(timeSlot); without this the MCP39F511 returns a NACK. Also the returned data is returned in blocks of two bytes. Data sent to the MCP39F511 Data received from the MCP39F511 I did attempt to use SerialEvent but that did not seem to run correctly or how I was hoping it would. If anyone can give me some pointers as to what I may be doing wrong and why the code appears to run erratically I would very much appreciate the help. Thankfully Kas
  11. Hello, I am attempting to use the CC3200 M2X Button press demo with no positive results. I am constantly getting a -1 error (No Connection). I can see on the on teh serial output that I have an IP address and that I'm connected to my WiFI router. I have also tried a similar demo (LaunchPadWiFiPost) using the MSP430F5969 with no issues. If anyone has any suggestions as to what is going on and why I am getting a no connection error I would appreciate any information. Kas
  12. Kazz

    Disabling JTAG Mode

    Does anyone know how to disable the JTAG on the MSP430G2553 and more specifically when using it with the launchpad Thanks Kazz
  13. Kazz

    USCI_B0 in SPI mode

    Thank you guys for all of the suggestions, I have now tried both RobG's suggestion as well as cuberg's and neither have solved the issue. I have used the sample code that TI gives you as examples for all the different ports and I can get SPI working on port A. When I try I2C on port B (no SPI examples for port B ) I don't see a clock tick or anything going out. While I originally thought this was due to the JTAG, when I set all my pins as GPIO (P1.0-7 & P2.0-7) and switch them up and down I can see that on the scope, so i have some control of these pins and therefore assume not a JTAG issue. This is really getting frustrating because I can't think of any other tests to do to try solve this issue and I cant find any example code online of someone using port B in SPI mode. If anyone has any further suggestions for me to try, I will happily do so. Thanks Kazz
  14. Kazz

    USCI_B0 in SPI mode

    Does this include the CLK line not giving any form of output, because I did not see any clock signal on the clock line. I also did try out of frustration to remove the jumpers to both LEDs and still nothing. Looks like the P1.4-7 pins are acting in JTAG mode but I can't seem to work out how to verify this or to change this. This was a suggestion by someone at TI but they gave no further information. RobG I'm not sure how this differs from the second code sample I submitted, unless changing the order in which you set-up P1SEL and P1SEL2 may have an effect. As for the second function, wont this waste a lot of cycles. I will however give this second function a try even though nothing there should stop the clock as far as I can tell... but you never know. (i should at least see the clock output if nothing else)
  15. Kazz

    USCI_B0 in SPI mode

    Here is the updated function I tried int initSPI(void) { P1OUT = 0x00;[/indent] P1SEL = BIT5 + BIT6 + BIT7; // Configure SPI on USCI0 port B[/indent] P1SEL2 = BIT5 + BIT6 + BIT7; // Configure SPI on USCI0 port B[/indent] //UCB0CTL1 |= UCSWRST; // Disable USCI[/indent] UCB0CTL0 |= UCCKPL + UCMSB + UCMST + UCMODE_0 + UCSYNC; // 3-pin, 8-bit SPI master /*TODO: Update This Line*/[/indent] UCB0CTL1 |= UCSSEL_2;// + UCSWRST; // SMCLK[/indent] UCB0BR0 |= 0x01; // prescaler LSB (UCxxBR0 + UCxxBR1 * 256) = Prescaler[/indent] UCB0BR1 = 0x00; // prescaler MSB[/indent] UCB0CTL1 &= ~UCSWRST; // Initialise USCI state machine[/indent] IE2 |= UCB0RXIE; // Enable USCI0 RX interrupt[/indent] P1OUT |= 0x08; // Set high to deselect IC[/indent] P1DIR |= 0x08; // Set as CS for SPI[/indent] return 0;[/indent] } This didn't help the issue, but thank you for the suggestion. I also tried starting up the launchpad with the TEST and RST jumpers removed, this too did not provide anything on the outputs. I'm really getting confused with this one now. :-(
×