2020-05-20 06:35 AM
I'm trying to get TM1809 led driver working with stm32 mcus, I tried with f103 and f030 ones but had same results, I can successfully send 1 to the driver but can't send 0, looking at it with oscilloscope it seems even at low-est delay possible the pin remains in High state longer than it should and as I extend the time pin remains in LOW state without touching High state-s delay it still increases. Is that some kind of stm32 mcu problem that I am unaware of or am I doing something wrong with it?
2020-05-20 06:49 AM
My guess is that you are trying to bit-bang the pattern using the HAL function-calls. And I would not expect things to work under those circumstances.
You could try descending into raw assembly code. But you cannot allow interrupts to happen during the time-critical write.
I see two approaches:
One is to take a leaf from the ST "emulated UART" application note, where an arbitrary bit-pattern is programmed into memory, then DMA is driven off a timer to write this block of memory to the BSRR register of the GPIO port.
Another is to see if you can use e.g. the SPI peripheral to pump the desired pattern out at a sensible rate.
Some preprocessing will be needed in either case.
Hope this helps,
Danish
2020-05-20 07:23 AM
Doesn't look good. In the data sheet I found ( http://www.normandled.com/upload/201603/TM1809%20Datasheet.pdf ) it says that the logic power supply voltage (VDD) is 4.5 to 5.5V, the input low voltage 0 .. 0.3 VDD, and the input high voltage 0.7 VDD .. VDD.
With VDD=4.5V, input low = 0 .. 1.35V and input high = 3,15V .. 4.5V. With VDD=5V, the input high would be 3.5V..5V.
I think it could work, but not necessarily. I didn't check the chip to MCU direction, and the SPM32F103 data sheet didn't give the numbers for uA level currents.
It may work if you adjust the power source voltages of the STM32 and the TM1809 in an optimal way.
This is more for 5V devices, like Arduino.
2020-05-21 02:42 AM
Well spotted turboscrew.
You could work around this by way of a level-shifter, or use a 5-V tolerant pin set to be open-drain on the stm32, with an appropriate pull-up resistor to +5V
2020-05-21 03:13 AM
That's the usual way in these situations - or changing to 3.3V I/O level LED driver.