Trying to make STM32F103 and HC-05 work together

Post here first, or if you can't find a relevant section!
User avatar
tutankhamen
Posts: 12
Joined: Tue Dec 05, 2017 9:27 am
Location: San Francisco

Re: Trying to make STM32F103 and HC-05 work together

Post by tutankhamen » Wed Dec 06, 2017 6:17 pm

mrburnette wrote:
Wed Dec 06, 2017 1:24 pm
You can always use your PC if equipped with BT (for testing.)

Also, serial device to device transfer can confound anyone. Years ago, I built a QBF Arduino unit to both send and receive 4800/9600 serial streams. Maybe I should update the design to use BT.

https://www.hackster.io/rayburne/the-qb ... tor-ae7015

Anyway, if you have an old mini/micro AVR board around, you might build yourself a QBF.


Ray
Thank you, I'm sure I have to make one.

User avatar
tutankhamen
Posts: 12
Joined: Tue Dec 05, 2017 9:27 am
Location: San Francisco

Re: Trying to make STM32F103 and HC-05 work together

Post by tutankhamen » Wed Dec 06, 2017 6:25 pm

MarkB wrote:
Wed Dec 06, 2017 1:47 pm
What's going on in the rest of your code?

One possibility that comes to mind is that interrupts are being disabled (or a long (relative to the serial character rate) period of time spent in an interrupt service routine) in some other section of the code for a long enough period to cause Serial to misbehave. A test would be to cut out everything except for the minimum necessary to receive the character string.

This brings up the question of how you are looking at the received data to see that is in error. That is, is it echoed back to Serial1/Bluetooth, a different port, or shown on a local display?
Actually, I'm working with minimum configuration right now, as I mention, I connected Arduino Nano to STM32 uart, which sends 10 bytes every 5 seconds and problem is still there. The only thing I have connected to stm32 is ssd1306 oled display which I'm using for debugging. Also, I'm driving WS2812B led strip, so, probably it could be the reason. I will try to make a minimal sketch for the investigation.

User avatar
tutankhamen
Posts: 12
Joined: Tue Dec 05, 2017 9:27 am
Location: San Francisco

Re: Trying to make STM32F103 and HC-05 work together

Post by tutankhamen » Thu Dec 07, 2017 5:49 am

I found the origin of the problem. I'm using FastLED library which disables interrupts:

https://github.com/FastLED/FastLED/issues/488

This is very reasonable for driving LEDs, but it ruins everything else :( So, now I can drive LEDs smoothly, but I can't receive via UART interface (and not only UART) or, if I enable interrupts, animation will not be that smooth.

So, now I have another problem - how to receive data on stm32f103 with disabled interrupt? As I know, there are some custom implementations for arduino which don't use interrupts, is there something like this for stm32_arduino library?

Thank you!

User avatar
RogerClark
Posts: 7481
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Trying to make STM32F103 and HC-05 work together

Post by RogerClark » Thu Dec 07, 2017 6:29 am

What are you doing that needs LEDs turned on and off to such extremes

Are you sending IR data ?

User avatar
tutankhamen
Posts: 12
Joined: Tue Dec 05, 2017 9:27 am
Location: San Francisco

Re: Trying to make STM32F103 and HC-05 work together

Post by tutankhamen » Thu Dec 07, 2017 8:39 am

I need to update 600 x WS2812b LEDs 60 times per second :)

User avatar
RogerClark
Posts: 7481
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Trying to make STM32F103 and HC-05 work together

Post by RogerClark » Thu Dec 07, 2017 8:56 am

You should have probably mentioned that in your post

There are 2 or 3 libs which use DMA in one form or another, you would need to use one of those or write your own

Try googling the forum for WS2812b , as you chance of finding the libs is a much as mine (apart from I have the one I wrote in my github account), and one was written my Rick Kimball, I can't remember who wrote the 3rd one

The lib you are using is probably the one I started with and is just a slightly modified version of the Adafruit lib and breaks USB and timeing and everything else as it disables the interrupts (which you should not do)

User avatar
tutankhamen
Posts: 12
Joined: Tue Dec 05, 2017 9:27 am
Location: San Francisco

Re: Trying to make STM32F103 and HC-05 work together

Post by tutankhamen » Thu Dec 07, 2017 7:19 pm

Thank you! I think you're right and I'd better to find better implementation of WS2812b, so, I'm going to dig into it.

User avatar
Pito
Posts: 1628
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

Re: Trying to make STM32F103 and HC-05 work together

Post by Pito » Fri Dec 08, 2017 12:29 am

HC-05 module is feeding from STM32F103's +5V and RX/TX are connected to the 5V tollerant PA9/PA10 pins. This is what you meant? Sorry, I'm not a HW guy,
The vanilla HC-05 module is 3.3V Vcc, unless it is a module with a 5V->3.3V voltage regulator (HC-05 mounted on a breakout board).
Pukao Hats Cleaning Services Ltd.

User avatar
tutankhamen
Posts: 12
Joined: Tue Dec 05, 2017 9:27 am
Location: San Francisco

Re: Trying to make STM32F103 and HC-05 work together

Post by tutankhamen » Fri Dec 08, 2017 5:23 pm

Pito wrote:
Fri Dec 08, 2017 12:29 am
HC-05 module is feeding from STM32F103's +5V and RX/TX are connected to the 5V tollerant PA9/PA10 pins. This is what you meant? Sorry, I'm not a HW guy,
The vanilla HC-05 module is 3.3V Vcc, unless it is a module with a 5V->3.3V voltage regulator (HC-05 mounted on a breakout board).
I feed it with 5 volts, but it has voltage regulator. I have this interface board:
Image

Post Reply