cancel
Showing results for 
Search instead for 
Did you mean: 

How can i reduce the baudrate with software

karatepe101
Associate II
Posted on July 29, 2015 at 08:19

Hi again :) i am using bluetooth module in my project. My bluetooth module support 1200 bps to 921.6Kbps.However i need first set up 300 bps.Then i need use 600-1200-2400-4800-9600 or 19200 bps .How can i?

10 REPLIES 10
megahercas6
Senior
Posted on July 29, 2015 at 12:10

So problem is with blue-tooth part ?

If yes, read datasheet and first understand how low can you go with bluetooth module, and after that, reconfigure prescalers inside uart config at stm part

stm32forum
Associate II
Posted on July 29, 2015 at 12:34

First setup the serial port with 300 baud, send the appropriate AT commands to change the baudrate of the bt module then setup the serial port again for the new baudrate.

 

Posted on July 29, 2015 at 12:41

USARTx->BRR = APBxCLK / Baud;

You could add some rounding, and you might need to enable/disable the USART to do it, and you'd definitely want to wait for the TC event to ensure the current data left the part so as not to change the rate mid-transmission.

Not clear what STM32 part you're using, you can usually pull the APB clocks via RCC_GetClocks() or similar API
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
karatepe101
Associate II
Posted on July 29, 2015 at 13:42

Yes,my problem with bluetooth module.Beacuse it doesn't support 300 bps communication.

Posted on July 29, 2015 at 15:00

So you have TWO USART channels, and you're trying to mitigate the difference in speed between them?

Do either of the serial connections support flow control?

Can you use a simple ring-buffer (FIFO) construction and use those to forward between the serial channels?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
karatepe101
Associate II
Posted on July 29, 2015 at 15:18

Yes i have 2 Usart channels but unfortunately i use both of them.S,i don't use FIFO ring buffer.

Methinks,i should use other hardware

Posted on July 29, 2015 at 16:20

Well that's a design decisions you'll have to make with far more information about the requirements than I.

What's 300 baud used for these days? If you're trying to auto-baud there are better ways to do that.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
karatepe101
Associate II
Posted on July 30, 2015 at 12:45

I am using IEC 62056 protocol for smart electric meter reading.According as this protocol,first communication baudrate is 300,then changes

Posted on July 30, 2015 at 15:34

Ok, but that's not bluetooth, right.  You can talk over bluetooth at rates convenient to that connection, and negotiate whatever rate you need with the meter over it's connection, and mitigate the difference with the STM32.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..