This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS: Bit delay formula for Software UART.

Other Parts Discussed in Thread: MSP430FR5969

Tool/software: Code Composer Studio

Hi , this is Harikrishna

Currently i am working on Software UART Creation, I successfully created the software UART by using GPIO pin and Bit delay in MSP430FR5969/5994.

but i do have some confusion in calculating the delays between bits(bit banging method) to transfer.

i followed the formula like (Clock_Frequency/Baud rate) to maintain delays between successive bits.

ex:

if My clock frequency = 8 Mhz(8000000).

Baud Rate = 9600.

One Bit Delay = 8000000/9600 = 833(working).

I used same number of ( __delay_cycles(800);)delay in my code between two successive bits then my Software UART Transmit(TX) is working and i able to see the information on serial monitor.

One Bit Delay = 8000000/115200 = 69(Not working)

But ,i used the same formula for Different Baud Rate(115200) and its value is 69 is not working and garbage values are printing in serial monitor.

Then after changed manually the value by trail and error method, and UART-TX working with delay value of 21(__delay_cycles(21);) for 115200 Baud Rate.

So literally i confused what really makes the Software UART-TX to work what exactly delay i should Maintain between bits, Because i want to test my Software Uart-Tx with all possible Frequencies that our controller supports.

These are one bit period values for the Baud rate and frequencies that i worked for now but what exactly the formula that i don't know

Frequency                   Baud Rate         one bit period Value(successive bits delay)

8mhz                            9600                  833(working)

8mhz                            115200              69(Not working),21(working)

16Mhz                          9600                  1250(working).

So please anyone help me that one bit period formula for different frequencies(1Mhz, 2Mhz, 4Mhz, 8Mhz, 16Mhz, 24Mhz, 48Mhz) and different baud rates(9600,,38400,115200). for our Controllers.

Thanks.

 

**Attention** This is a public forum