Hello there,
I am trying to control 2 LED strips (one with a WS2811 LED driver and one with a USC512C4 LED driver) with my STM32L4 with integrated RS485.
Do you have any idea how to do this?
Best regard.
P.Congré
Hello there,
I am trying to control 2 LED strips (one with a WS2811 LED driver and one with a USC512C4 LED driver) with my STM32L4 with integrated RS485.
Do you have any idea how to do this?
Best regard.
P.Congré
I should have added that there's also useful material about DMX512 here on the community. Here are a couple of good examples from shabaz and from genebren
DMX Explained; DMX512 and RS-485 Protocol Detail for Lighting Applications
DMX diagnostic tool - Getting started
DMX diagnostic tool - Sending and Receiving Data
Hello Jon,
I managed to control my LED strip with the USC512C4 IC with my arduino, but I need to do it with my STM32L4 but I can't find anywhere how to do it.
Do you have a code example for an STM32L4?
Best regard.
P.Congré
Sorry, I don't have any code I can give you.
Can't you port what you're doing with the Arduino to the STM32L4? It shouldn't be too difficult to send serial characters, so the tricky bit will be the break as that depends very much on what the particular serial peripheral can do. It might allow you to do it directly. Or you might be able to see a way to do it indirectly (by, for instance, enabling and disabling the peripheral so that it moves back to being an IO pin for a time, or by flipping the sense of the output pin if it can be changed from positive true to negative true). If you can't see a way to do it in the processor, you could always add an external logic gate to switch between serial and the break state. You'll probably need to use a timer to get the break period, so you'll have to work out how to do that too (I'm sure there's plenty of material on how to do that kind of thing).
Hello Jon,
There is no communication between the arduino and the STM32L4, and i can't port yhe arduino code to the stm32.
With the arduino, I managed to control my LED strip with DMX protocol (the LED strip has a USC512C4 IC).
Now I want to control the LED strip with my STM32L4 but it is quite difficult.
I use an RS-485 to create the DMX communication. I found some codes on the internet but it doesn't work.
https://github.com/aleksandrgilfanov/stm32f4-dmx-transmitter/blob/master/Src/main.c
https://github.com/carl3721/stm32-dmx512/blob/master/dmx-p103/src/main.c
Best regard.
P.Congré
The project at the first link you give appears to be based on some modified ST code. Perhaps you could ask ST for the original code if you can't find it on their website. It's very unlikely they would issue anything that didn't work.
Is there a reason why you can't just use the Arduino, since you have that working?
The project at the first link you give appears to be based on some modified ST code. Perhaps you could ask ST for the original code if you can't find it on their website. It's very unlikely they would issue anything that didn't work.
Is there a reason why you can't just use the Arduino, since you have that working?
I already tried to contact ST, but nothing for the moment.
I can't use arduino because the next step of the project is to control the LED strip with an STM32.
best regard.
P.Congré
If you don't mind a hardware engineer telling you how to deal with debugging, here's how I'd tackle it:
Does anything at all emerge from the STM32? Can you see any sign of serial waveforms at the output pin, even if it just sends a frame of 513 characters and then freezes at the break?
Is your 485 chip matched to the IO voltage standard of the processor? [Not all of the older ones would be ok on 3.3V]
What can you see on the A and B outputs of the driver chip?
Have you wired the outputs the right way round to the LED strip?
If you see a lot of overshoot and the sigals are very messy, look carefully at how you've done the termination on the RS-485. [The strip might be much more fussy than a normal DMX receiver.]
If there's still nothing, try hacking together a bit of very simple test code to repetitively send a serial character and look again.
If that works, go back to the DMX code and disable the stuff that does the break [the fiddly stuff with a timer that could esily go wrong] and verify that it's sending the character stream ok, then start working on the break code, maybe even isolating it and just repetitively sending the break until you get the timing right.
I can see the waveform of my TX PIN when I send 513 times a "U".
The 485 chip matches the IO voltage, I checked it and I can also see the waveform of the A and B output.
I double checked the cable connection for the LED strip.
I know it's not hardware but rather software, I couldn't create a correct code to control the LEDs.
Best regard.
P.Congré
^ Great debugging tips from Jon.
Right now I'm trying to get hardware and software working. I did not create the hardware nor the software, but I won't raise a case until I've:
1. Verified connections and voltages
2. Connected a 'scope or attached a logic analyzer (they cost less than $20) and examined if the interface signals are what I expect
3. Grabbed debug from the code
4. Tried different hardware and software combinations to try to narrow down the problem
5. Sketch a diagram or take photos or video to show precisely what I'm doing
6. Supply any configurations or log file content
For your scenario, maybe point 2 and 4 are also relevant, since you could compare the working scenario (Arduino) with the non-working scenario, and compare the signals, to see what the difference is.
Here are a couple of things to check:
Good luck!
That's good. You're not far off a working system.
Do you see the break, after the frame of data is sent, present in the DMX waveform?
I've never used the devices on the LED strip, but they probably depend on the subsequent break as part of their operation.
It's also part of the DMX spec that you have to keep sending the break and the frame repetitively. I don't think the spec says what the receiver should do if the DMX disappears, but I think it implies the designer of the receiver should do something for what is then considered to be a fault condition if it disappears for more than a second or two [for a lamp in a theatre setting, the normal thing would be for it to shut down on loss of DMX to stop it interferring with the rest of a lighting rig].
The problem is that I don't really know what line to follow to create the code, I know I need to set up a uart communication with 250000 bauderate.
I know the DMX protocol but I don't know how to implement it in my stm32.
The code for the arduino is an example that I modified to create different animations.
best regard.
P.Congré
Paul,
I do not have much (if any) experience with STM32, but I did find this code that might help you along:
https://github.com/carl3721/stm32-dmx512/blob/master/dmx-p103/src/main.c
It was an easy search of "stm32 dmx example", which seem to have lots of results.
I take from all of this that is very new to you. I have found that Google is your friend, and you will likely find lots of help there (and here). You really need to break it down into little pieces when you are looking for help. DMX has been around for quite a while, but there are not many examples, as a lot of people are buying solutions from a small handful of suppliers, that wrap all of the messy stuff up into libraries or standalone hardware.
Gene
Hello Gene,
I've already tried this git repository, it's only used to receive data, I'm trying to send data to the control light.
Best regard.
P.Congré
The two links to code that you posted are both code bases for STM32F10x processors - you are using an STM32L4xxx which will be different.
I can't guess all the things (if any) which will be wrong without:
1) Your code
2) A schematic or detailed block diagram of your set up
3) A pin list showing which processor pins are used for what
It would also help if you told us what software and debugging tools you are using (including do you have a scope or logic analyser).
Pictures often help as well.
MK