Jump to content
Sign in to follow this  
hariz

MSP430F5529: Can't connect the bluetooth HC-06 with MSP430F5529

Recommended Posts

Hello,

I have been working with the MSP4305229 Launchpad and have been trying to work with Bluetooth. I'm using HC-06 module. Currently use energia to programmed the code. During the compiling, it produce the error code. I have been trying use others code and still produce the same error. Do you have any ideas to solve the error? Kindly seek your assistance. 

Thank you.

 

Here the message of error. 

Energia: 1.8.7E21 (Windows 10), Board: "MSP-EXP430F5529LP"

C:\Users\Harizazmi\Desktop\energia-1.8.7E21\hardware\energia\msp430\libraries\SoftwareSerial\SoftwareSerial.cpp:81:2: error: #error This version of SoftwareSerial supports only 16MHz processors

C:\Users\Harizazmi\Desktop\energia-1.8.7E21\hardware\energia\msp430\libraries\SoftwareSerial\SoftwareSerial.cpp: In member function 'void SoftwareSerial::begin(long int)':

C:\Users\Harizazmi\Desktop\energia-1.8.7E21\hardware\energia\msp430\libraries\SoftwareSerial\SoftwareSerial.cpp:251:31: error: 'table' was not declared in this scope

C:\Users\Harizazmi\Desktop\energia-1.8.7E21\hardware\energia\msp430\libraries\SoftwareSerial\SoftwareSerial.cpp: In member function 'virtual size_t SoftwareSerial::write(uint8_t)':

C:\Users\Harizazmi\Desktop\energia-1.8.7E21\hardware\energia\msp430\libraries\SoftwareSerial\SoftwareSerial.cpp:319:26: error: 'XMIT_START_ADJUSTMENT' was not declared in this scope

exit status 1
Error compiling for board MSP-EXP430F5529LP.

 

This is the coding. 

// define TROUBLESHOOT

#include <SoftwareSerial.h>

SoftwareSerial bluetooth(P3_4, P3_3); // RX, TX

int i;
int j; 
int min;
int max;


float rms; 
float totalF;
float a0;
float a1;
float b1;
float a2;
float b2;
float a3;
float b3; 
float a4;
float b4;
float a5;
float b5;
float a6;
float b6;
float rmsac;
float h1;
float h2;
float h3;
float h4;
float h5;
float h6;
float thd;
float total;
float multiply=1.459;

uint16_t adc[180];
float timer;

char data=0;

void setup()
{

Serial.begin (9600);
bluetooth.begin(9600); //bluetooth


}

void loop() 
{

i=0;
timer=millis();
while(millis()-timer < 20) //Get sample ADC in 20ms
{
adc=analogRead(A0);
i++;
}

j=0;
min=1023;
max=0;

total=0;

#if defined (TROUBLESHOOT)
Serial.println(i);
#endif

for(j=0;j<i;j++)
{
#if defined (TROUBLESHOOT)
Serial.println(adc[j]);
#endif
if(adc[j]>max) max=adc[j];
if(adc[j]<min) min=adc[j];
total+=adc[j]*adc[j];
}
total=total/i;
rms=sqrt(total);

total=0;
for(j=0;j<i;j++)
{
total+=adc[j];
}
a0=(float)total/i;

totalF=0;
for(j=0;j<i;j++)
{
totalF+=adc[j]*cos(2*PI*j/i);
}
a1=(float)2*totalF/i;


totalF=0;
for(j=0;j<i;j++)
{
totalF+=adc[j]*sin(2*PI*j/i);
}
b1=(float)2*totalF/i;

totalF=0;
for(j=0;j<i;j++)
{
totalF+=adc[j]*cos(2*2*PI*j/i);
}
a2=(float)2*totalF/i;

totalF=0;
for(j=0;j<i;j++)
{
totalF+=adc[j]*sin(2*2*PI*j/i);
}
b2=(float)2*totalF/i;

totalF=0;
for(j=0;j<i;j++)
{
totalF+=adc[j]*cos(2*3*PI*j/i);
}
a3=(float)2*totalF/i;

totalF=0;
for(j=0;j<i;j++)
{
totalF+=adc[j]*sin(2*3*PI*j/i);
}
b3=(float)2*totalF/i;

totalF=0;
for(j=0;j<i;j++)
{
totalF+=adc[j]*cos(2*4*PI*j/i);
}
a4=(float)2*totalF/i;


totalF=0;
for(j=0;j<i;j++)
{
totalF+=adc[j]*sin(2*4*PI*j/i);
}
b4=(float)2*totalF/i;

totalF=0;
for(j=0;j<i;j++)
{
totalF+=adc[j]*cos(2*5*PI*j/i);
}
a5=(float)2*totalF/i;

totalF=0;
for(j=0;j<i;j++)
{
totalF+=adc[j]*sin(2*5*PI*j/i);
}
b5=(float)2*totalF/i;

totalF=0;
for(j=0;j<i;j++)
{
totalF+=adc[j]*cos(2*6*PI*j/i);
}
a6=(float)2*totalF/i;

totalF=0;
for(j=0;j<i;j++)
{
totalF+=adc[j]*sin(2*6*PI*j/i);
}
b6=(float)2*totalF/i;


rmsac=sqrt(rms*rms-a0*a0);
h1=sqrt((a1*a1+b1*b1)/2);
h2=sqrt((a2*a2+b2*b2)/2);
h3=sqrt((a3*a3+b3*b3)/2);
h4=sqrt((a4*a4+b4*b4)/2);
h5=sqrt((a5*a5+b5*b5)/2);
h6=sqrt((a6*a6+b6*b6)/2); 
thd=100*sqrt(rmsac*rmsac-h1*h1)/h1;

 


#if defined (TROUBLESHOOT)
Serial.println("MIN="+String(min));
Serial.println("MAX="+String(max));
Serial.println("RMS="+String(rms));
Serial.println("A0="+String(a0));
Serial.println("A1="+String(a1));
Serial.println("B1="+String(b1));
Serial.println("A2="+String(a2));
Serial.println("B2="+String(b2));
Serial.println("A3="+String(a3));
Serial.println("B3="+String(b3));
Serial.println("A4="+String(a4));
Serial.println("B4="+String(b4));
Serial.println("A5="+String(a5));
Serial.println("B5="+String(b5));
Serial.println("A6="+String(a6));
Serial.println("B6="+String(b6));
Serial.println("H1="+String(h1));
Serial.println("H2="+String(h2));
Serial.println("H3="+String(h3));
Serial.println("H4="+String(h4));
Serial.println("H5="+String(h5));
Serial.println("H6="+String(h6));
Serial.println();

#else
Serial.print("RMS:"+String(multiply*rmsac)+",");
Serial.print("H1:"+String(multiply*h1)+",");
Serial.print("H2:"+String(multiply*h2)+",");
Serial.print("H3:"+String(multiply*h3)+",");
Serial.print("H4:"+String(multiply*h4)+",");
Serial.print("H5:"+String(multiply*h5)+",");
Serial.print("H6:"+String(multiply*h6)+",");
Serial.print("THD:"+String(thd)+";");
Serial.println();

if(data=='C')
{
bluetooth.print("RMS:"+String(multiply*rmsac)+"A");
bluetooth.print("THD:"+String(thd)+"B");
bluetooth.print("H1:"+String(multiply*h1)+"C");
bluetooth.print("H2:"+String(multiply*h2)+"E");
bluetooth.print("H3:"+String(multiply*h3)+"F");
bluetooth.print("H4:"+String(multiply*h4)+"G");
bluetooth.print("H5:"+String(multiply*h5)+"I");
bluetooth.print("H6:"+String(multiply*h6)+"J");
}
#endif

if(bluetooth.available())
{
data=bluetooth.read();
}


delay (1000);
}

 

Share this post


Link to post
Share on other sites

With C/C++ compilers you want to address/fix errors in the order they are presented - that is, read and understand that first error.  Generally, compilers will cascade a long series of errors that all are triggered by that first error. FWIW, a missing semi-colon can trigger a similar long list of errors.

So, looking at your first error message:

" C:\Users\Harizazmi\Desktop\energia-1.8.7E21\hardware\energia\msp430\libraries\SoftwareSerial\SoftwareSerial.cpp:81:2: error: #error This version of SoftwareSerial supports only 16MHz processors"

It's telling you that you have not selected the 16MHz version of the launchpad.  If I remember correctly the F5529 board has two entries, one for 16MHz and the second for 24MHz.  The SoftwareSerial library is not compatible with the 24MHz version.  Further, hardware serial is the preferred library with the F5529. 

So, changing the board in Energia and calling the other library in your code should be your first steps.

Share this post


Link to post
Share on other sites

This line should also not be there.

#include <SoftwareSerial.h>

The F5529 has a hardware UART for the Serial.

The SoftwareSerial.h is only used internally in Energia on devices where a Hardware UART is not available.

Share this post


Link to post
Share on other sites

@NurseBob  currently i want to use 16Mhz entries. Do i need to change the program code or change the connection in board? Futhermore, can you teach me to make the programmed work? Hope you can assist me. 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×