How to upload to Arduino STM32 with HC-05 Serial Bluetooth - bluetooth

I got myself a little STM32F103C8T6 based board that is similar in size to the Arduino Nano, but with a little bit more memory and speed. But for me more important, with 3.3V I/O. It can also be used with the Arduino IDE after you install the correct libraries.
I wanted to connect this to a HC-05 serial bluetooth, especially for remote uploading. But this didn't work. Basic transfer worked, but upload for reprogramming failed.
I tried to adjust the baudrate with AT-commands of the HC-05: e.g.:
AT+UART=57600,0,0
But it still didn't work. What is wrong?

After several tests I noticed that stm32flash printed "8e1" as upload setting. This means even parity. So the correct AT-command should be:
AT+UART=57600,0,2
Baudrates 115200 and 230400 also worked as long as the parity is correct.
But since there are even more things that can go wrong, here is some more information:
Connecting via bluetooth to the HC-05 required using the default password "1234". (This can later be changed with command "AT+PSWD=....".)
Then on my Windows 10 machine two new COM-ports appeared, of which only one was functional.
The most confusing thing was that on Windows you still can adjust the baud rate and serial settings, but it has no effect!
To use the AT-commands I had to connect to another serial port (from an USB to serial adapter). Holding the "Key"-button during power-on enables the AT-mode with 38400 baud.
There is a video that shows the details for a regular Arduino:
https://www.youtube.com/watch?v=xXUKfTNHkKE
"HC 05 Bluetooth Wireless Upload to Arduino" (Wayne Holder)
Even with the correct baud settings, remember to put the STM32 board into correct boot mode and press RESET. And use the correct COM-port.
If you use the serial port in your uploaded program you also must remember to use these settings. E.g.:
Serial.begin(57600,SERIAL_8E1); // for serial init

Related

Emulate a UART like piece of hardware in linux

In order to test a piece of software, I need to write an emulator. This emulator has to represent the hardware very closely, it has to be able to start off at 300 baud, then negotiate with the software and eventually end up at another baudrate, for example. Also, things like parity and additional stop bits are very important.
How can I emulate such a device under Linux? I tried pty's, but it seems immume for baudrate settings and parity settings. I also tried socat, but it suffers the same fate: no matter how you configure the receiver, the data always arrives fine. I need this emulator to be able to send out the data on 300 baud in such a way that if you listen at 9600 baud you get rubbish at best. How can I do such a thing?

Bluetooth SPP module SPP-C SPP-CA BK3211 chip - entering AT mode?

I have Bluetooth SPP module SPP-C / SPP-CA , it is cheap module that should work the same way as well known HC-06 / HC-05 modules.
I have got one problem, everything works, module is communicating over serial interface pairing etc... but i can not enter the AT mode to change device name pin or baud rate. Does anyone had the same problem and how to solve it ? there is a very small data published and sellers are not responding.
So I assume that someone may help with that situation. http://www.ebay.com/itm/Bluetooth-Module-UART-Serial-Interface-SPP-CA-works-with-YZXstudio-USB-Monitors-/201414967094 that's the module. it is based on Beken BK3211 chip.
It seems that nothing special is needed to enter command mode on the SPP-CA module I have.
Whenever you connect or disconnect by bluetooth, the module will print:
CONNECTED
.. serial data is transferred ..
+DISC:SUCCESS
When the module is disconnected, you can execute AT commands such as AT+BAUD just like with HC05 modules.
3 years later and I've looked everywhere for an answer to this question and finally stumbled upon the solution by fiddling away.
I am connecting via an FTDI module using Teraterm software to enter commands.
You need to power up the FTDI and BT modules by plugging into PC USB. open Teraterm and set up to see the COM port.
Now you have to momentarily connect GND to port 11 on the BT module to 'reset' the module. The module will power down and back up again and in doing so will enter AT mode and you should be able to communicate with the module.
Good luck
Old question however still relevant, I found the solution! It is pretty simple, you can use an breadboard and some jumper wires however you can also create an adapter like I did. Like explained in this document with AT-commands, you need another UART (serial connection) to program the SPP. The SPP must not connected to anything (discovery mode) to be able to program it.
You can do this, like I did, with another SPP or you can use serial programmer or an Arduino. Notice that the serial connection is 3V, so when using an Arduino you need some resistors (1K and 2K) to create a voltage divider (google it).
The schematic is pretty simple (when not using an Arduino), I designed this adapter:
You need these components to create the adapter (and maybe some wires):
Connect everything like in the schematic above (STATE and EN are not connected), insert the modules (take care of pin orientation!), insert an USB cable and connect it to some power source.
In Arduino IDE, select the com-port you want to configure and launch the Serial monitor, you can now enter AT-commands to configure the one that is not connected:
Done! That is pretty easy right? When you want to configure the other, disconnect the one that is connect and connect the other one. An overview of AT-commands can be found in the document in provided link above.
Hopes it helps ;-)

How to use APC220 Radio Communication Module in raspberry pi

I am developing a project using Arduino to send a message to Raspberry Pi using an APC220 Radio Communication Module.
The Raspberry Pi can't receive serial message by using USB connect to APC220. I want to know how to use APC220 in Raspberry Pi?
The APC220 has a TTL UART interface which you can connect directly to the RPi TTL UART pins on the GPIO header - you do not need the USB-Serial converter (though that should work too if it is a standard CDC/ACM device - though this suggests that there may be issues).
A note of caution however, the RPi GPIO pins use 3.3Volt logic, the APC220 datasheet is not clear on the TTL level used, but the specified supply range is 3.3 to 5.5 volts so it seems likely that it is 3.3V - best measure it to be certain. You can probably use the RPi GPIO headers's 3.3V supply pin to power the ACM220, then you will be sure to be safe. If the ACM220 level is too high, the quick-and-dirty solution is to use current limiting resistors in-line to protect the RPi (10KOhm should be enough, but don't hold me responsible; you should know what you are doing before proceeding).
The UART device on the Pi is /dev/ttyAMA0.
See here for details of serial I/O on the Pi.
22 Feb 2012 Update
The discussion here suggests that to make the TTL<->USB adapter work on Raspberry Pi, you need to disconnect the EN signal - the discussion links back to the manufacturer documentation, which gives that advice in the troubleshooting section. Since that makes the device appear as a USB serial, and you won't have to reconfigure the on-chip serial or build a connector that may be simpler.

weird characters displayed during serial communication OSX

I have tried communicating via serial (OSX w/ prolific drivers -> USB RS232 adapter -> Tx,Rx and GND pins on device serial ttl port) to a device and done so successfully using
screen /dev/tty.usbserial 115200 8N1
I get to log in and use it as if I was SSH or TelNetted in...
However whenever I try to go into system recovery mode (holding CTRL+1) while the device is powering on, it starts displaying weird characters and until I close the screen session it will continue showing weird characters:
Of course when we tried doing the same thing on my boss' macbook running windows and PuTTY and everything worked fine, even in system recovery mode; characters were displayed properly.
What gives? Id like to learn the intuition to use because up till now I concluded that since I can bot into the system and see characters normally everything about the connection should be fine and its must have been the recovery partition that was broken. This was wrong of course...
Niko
Dunno if it is a OSX problem,
I had similar problems before. I fixed it either by changing the Baud rate of the com ports or by making sure the Ground on the circuit is the same as the ground of the supply.

PIC16F877A with bluetooth hc-06

I try to connect pic microcontroller PIC16F877A with pc via bluetooth hc-06.
Before I use bluetooth, I have tried to send data via serial cable, and open it with hyperterminal, and I have no problem with this system.
But when I try with bluetooth and open it with hyperterminal, it come with strange character, I suspect this happen because of the baud rate. But I set the PIC and hyperterminal with the same baud rate. I use 9600 8n+1 with no parity.
Any idea to solve this problem?
One of the documentations (link here) says that there are 2 ways to turn the module on: the way1 with baudrate 38400 and the way2 with baudrate 9600.
Also in the hyperterminal settings try to change the Emulation from 'ANSI' to 'VT100'

Resources