Page 2 of 2

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

Posted: Wed Dec 06, 2017 6:17 pm
by tutankhamen
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.

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

Posted: Wed Dec 06, 2017 6:25 pm
by tutankhamen
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.

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

Posted: Thu Dec 07, 2017 5:49 am
by tutankhamen
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!

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

Posted: Thu Dec 07, 2017 6:29 am
by RogerClark
What are you doing that needs LEDs turned on and off to such extremes

Are you sending IR data ?

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

Posted: Thu Dec 07, 2017 8:39 am
by tutankhamen
I need to update 600 x WS2812b LEDs 60 times per second :)

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

Posted: Thu Dec 07, 2017 8:56 am
by RogerClark
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)

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

Posted: Thu Dec 07, 2017 7:19 pm
by tutankhamen
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.

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

Posted: Fri Dec 08, 2017 12:29 am
by Pito
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).

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

Posted: Fri Dec 08, 2017 5:23 pm
by tutankhamen
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