Jump to content
43oh

delay time for SoftwareSerial in MSP430F5529 launchpad


Recommended Posts

//formula is roughly rxintra=rxstop=tx = F_CPU / baud / 3 - 5/3
//    so, delay = 16000000 / 3 / baud - 5/3
//      and, rxcenter = 1/2 rxintra
_DELAY_TABLE table[] =
{
  //  baud    rxcenter   rxintra    rxstop    tx
  {115200,   15,        32,        32,       32,      },
  {57600,    38,        78,        78,       78,      },
  {38400,    61,        123,       123,      123,     },
  {31250,    72,        155,       155,      155,     },
  {28800,    80,        170,       170,      170,     },
  {19200,    126,       262,       262,      262,     },
  {14400,    177,       353,       353,      353,     },
  {9600,     265,       540,       540,      540,     },
  {4800,     547,       1095,      1095,     1095,    },
  {2400,     1103,      2190,      2190,     2190,    },
  {1200,     2200,      4400,      4400,     4400,    },
  {300,      8881,      17762,     17762,    17762,   },
};

 

formula given above is not fitting to calculating DELAY_TIME for 16MHz.so how to calculate this value for F_CPU 25Mhz. because i want to using UART at 25Mhz 9600 Baud rate.so please help me to calculate above data for my MSP430F5529 launchpad 25Mhz F_CPU.
 

Link to post
Share on other sites

Energia should handle that for you, I would think.

 

The code below should take whatever you type in terminal and send the LP and echo it back to the terminal.

Using Win8, an F5529LP virtual serial backchannel and Energia's terminal window works fine with the few baud rates I tried; 2400, 9600 and 115200:

char c;

void setup()
{
  // put your setup code here, to run once:
  Serial.begin(2400);
  delay(500);
}

void loop()
{
  if (Serial.available()) {
    c = Serial.read();
    if (c !=-1) {
      Serial.print(c);
    }
  }
  Serial.println("");
}
I'm reading "char" here but you could use Serial.parseInt() to grab an integer or Serial.parseFloat() to grab a float.

However, that is not software serial so your results may differ.

Link to post
Share on other sites

Energia should handle that for you, I would think.

 

The code below should take whatever you type in terminal and send the LP and echo it back to the terminal.

Using Win8, an F5529LP virtual serial backchannel and Energia's terminal window works fine with the few baud rates I tried; 2400, 9600 and 115200:

char c;

void setup()
{
  // put your setup code here, to run once:
  Serial.begin(2400);
  delay(500);
}

void loop()
{
  if (Serial.available()) {
    c = Serial.read();
    if (c !=-1) {
      Serial.print(c);
    }
  }
  Serial.println("");
}
I'm reading "char" here but you could use Serial.parseInt() to grab an integer or Serial.parseFloat() to grab a float.

However, that is not software serial so your results may differ.

 

 

I am using this code but it's not working.Have you test this code in launchpad.is there is any jumper setting for this??/

Link to post
Share on other sites

Ohh....sorry.You are right now.Thanks for helping me.but there is still a question that from serialuart we can use any pins as serial port then how can i use hardwear uart for this.because if i use software uart then the code size increases and also use more CPU.

Link to post
Share on other sites

I'm really curious why one would bother with software UART on these chips when they clearly have 2 hardware UARTs (albeit, 1 wired to the backchannel UART but its jumpers can be removed and jumper-wired elsewhere if needed)

 

I'm not quite sure if UART is included in this feature, but, some of the pins on the F5529 can be "remapped" in software to expose their function on another I/O pin.  Called the Port Mapper subsystem, many of the F5xxx chips have it.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...