Most recent activity
-
- 67 comments
- 22,127 views
-
Unfortunately i don't have one...
I also found stm32's
jshDelayMicroseconds
function you were talking about earliervoid jshDelayMicroseconds(int microsec) { int iter = (int)(((long long)microsec * (long long)JSH_DELAY_MULTIPLIER) >> 10); // iter -= JSH_DELAY_OVERHEAD; if (iter<0) iter=0; while (iter--) __NOP(); }
I see the logic of this function like this:
iter = microsec * (how_fast_mc_is / how_fast_it_should_be)
But i don't understand how to make this function work with nanoseconds.
-
@allObjects, I finally managed to solder a second transistor as you offered. It looks terrible, but it works! Now the signal is not inverted. I also recompiled Espruino so that STM32 uses hardcoded timers and changed the timers from
\#define PATTERN_PULSE_T0H() for(uint32_t i = 0; i < 17; i++) {__NOP();} \#define PATTERN_PULSE_T0L() for(uint32_t i = 0; i < 33; i++) {__NOP();} \#define PATTERN_PULSE_T1H() for(uint32_t i = 0; i < 30; i++) {__NOP();} \#define PATTERN_PULSE_T1L() for(uint32_t i = 0; i < 20; i++) {__NOP();}
to
\#define PATTERN_PULSE_T0H() for(uint32_t i = 0; i < 7; i++) {__NOP();} \#define PATTERN_PULSE_T0L() for(uint32_t i = 0; i < 14; i++) {__NOP();} \#define PATTERN_PULSE_T1H() for(uint32_t i = 0; i < 13; i++) {__NOP();} \#define PATTERN_PULSE_T1L() for(uint32_t i = 0; i < 8; i++) {__NOP();}
But no matter what I send, the LED's are always white. My thought was if F405 is
168 MHz
and F103 is72 MHz
I should just scale the delay values proportionally. @Gordon, what am I missing here? -
May I ask what the thought is, not using SPI? Are we still attempting to solve why is the first Neo green here?
Yes, I am trying to solve this issue and another one at the same time: the second line of Neopixels is connected to a pin with no hardware SPI on it. Running a data line from the end of one line of LEDs to the beginning of another one feels terrible. This is why I am trying to workaround hardware SPI usage.
What we've got now: The LEDs are not damaged, even the first one (which is always green when controlled by Espruino). When I poke a wire from Arduino to Neopixel's data line everything works perfectly. But Arduino is 5v.
@Gordon, could you please tell me where can I find the code for the
F405
? I couldn't find it in Espruino sources. Is it outside of Neopixel lib or even deprecated? -
-
The LEDs are fine. I connected data line to Arduino and launched Adafruit's Neopixel demo sketch. Everything works beautifully.
I don't think SPI is the only way to run Neopixels with STM32. Basically, SPI is sending 4x more data at 4x more speed to mimic the LED's protocol. Does Espruino allow controlling a pin with a CPU directly with tiny timings, like: "set HIGH to the pin, wait for 450 nanoseconds, set LOW etc.." or it is a too low-level task?
-
Yay! We are getting somewhere, guys!)
But there is an issue with the first LED. Its green part always turns on no matter what color I set it to. When I reset the board all LEDs turn off, but when I turn them off manually by sending zeros, first always stays green. In the picture, I made a red to green gradient, you can see that first color is wrong.
@Gordon, the clock is fine, the problem was with the Neopixels soldered upside down. There was a misleading dot in the corner of every LED's footprint. I matched it with the notch of each LED but turned out that dot indicated power pin. When I replaced all the LEDs (they all burnt), the
af_opendrain
method worked. I just need to figure out the first LED's issue. -
Almost year passed and I solved the issue today. Unfortunately I had to drop Espruino and stick to low level HAL STM32 library. The LED pin is controlled by timer's PWM and DMA. If you invert the timer polarity simply changing one register everything starts working. I want to say a HUGE thanks to everyone who helped me with this problem. You guys are awesome. OMG I can finally finish my clock now, I am so happy!
I will post the clock here as soon as I finish them.