Hello,
I have a project in which I use bluetooth for transmitting data to a controller.
The baud rate is set by default to 9600 by the program (flowcode 4).
I would need higher baud rate for the data transfer.
Is it possible to change the baud rate in any macro?
If so in which macro should i make the change?
I know that when the baud rate is changed I also have to change S520 settings in the bluetooth module.
Regards
Erik
baud rate for bluetooth
- Steve
- Matrix Staff
- Posts: 3422
- Joined: Tue Jan 03, 2006 3:59 pm
- Has thanked: 114 times
- Been thanked: 422 times
- Contact:
Re: baud rate for bluetooth
Flowcode is fixed to communicate with this module at 9600, but you can alter it by customizing the C code for the Bluetooth component.
You will need to customize the [Defines] code, specifically you need to change the %d to an appropriate value in the following line:
At the moment, the Flowcode component calculates the correct value from the current clock speed of the chip and replaces the %d with it in this line. You will need to calculate the appropriate value yourself, but there are some comments in this [Defines] section of code that might help.
Also note that you will need to be communicating at 9600 baud to be able to set the baud rate of the module to something different. And once this value is set, you will need to communicate at the new baud rate. If you get this setting wrong, you may not be able to communicate with the module.
You will need to customize the [Defines] code, specifically you need to change the %d to an appropriate value in the following line:
Code: Select all
#define BLU232_BAUD %d
Also note that you will need to be communicating at 9600 baud to be able to set the baud rate of the module to something different. And once this value is set, you will need to communicate at the new baud rate. If you get this setting wrong, you may not be able to communicate with the module.
Re: baud rate for bluetooth
Hello Steve,
I changed S520 and S521 to 19200.
Then I changed the [Defines] code for the baud rate to 15= 19200.
#define BLU232_BAUD 15
As you wrote something must have gone wrong since I no longer has communication with the module.
Is it possible to write a reset program in Flowcode that can change the mudule back to default or can I throw the module?
Regards
Erik
I changed S520 and S521 to 19200.
Then I changed the [Defines] code for the baud rate to 15= 19200.
#define BLU232_BAUD 15
As you wrote something must have gone wrong since I no longer has communication with the module.
Is it possible to write a reset program in Flowcode that can change the mudule back to default or can I throw the module?
Regards
Erik
Erik
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: baud rate for bluetooth
Hi Erik,
Dont panick all is not lost, your module should be fine.
1) Try reverting the code back to default. This may mean uninstalling and reinstalling. Once you have done this does the module work?
if not then.,
2) Use something like a RS232 or USB232 E-Block to connect the lines of the bluetooth board up to a computer. Then use hyperterminal to play around with the settings until your get a response. Once you have a response you can alter the settings manually and store the new settings in to flash by typing AT commands into hyperterminal (realterm if you have Vista or Win 7).
Dont panick all is not lost, your module should be fine.
1) Try reverting the code back to default. This may mean uninstalling and reinstalling. Once you have done this does the module work?
if not then.,
2) Use something like a RS232 or USB232 E-Block to connect the lines of the bluetooth board up to a computer. Then use hyperterminal to play around with the settings until your get a response. Once you have a response you can alter the settings manually and store the new settings in to flash by typing AT commands into hyperterminal (realterm if you have Vista or Win 7).
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel