Avatar for George

George

Member since Jul 2018 • Last active Jan 2019
  • 3 conversations
  • 38 comments

Most recent activity

    • 65 comments
    • 3,759 views
  • in Interfacing
    Avatar for George

    Unfortunately i don't have one...

    I also found stm32's jshDelayMicroseconds function you were talking about earlier

    void 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.

  • in Interfacing
    Avatar for George

    @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 is 72 MHz I should just scale the delay values proportionally. @Gordon, what am I missing here?

  • in Interfacing
    Avatar for George

    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?

  • in The Place for Patreon Patrons
    Avatar for George

    Hi, I am supporting Espruino on Patreon, but I don't have patreon sign under my avatar as others do. Is this because of different emails here and on Patreon? How accounts are being matched?

  • in Interfacing
    Avatar for George

    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?

  • in Interfacing
    Avatar for George

    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.

  • in Interfacing
    Avatar for George

    It indicates the number of shots done. That's why I'm making 10-digit nixie display :D

  • in Interfacing
    Avatar for George

    How can I check the clock settings?

    Looks like I damaged one pin on my STM32 which was responsible for the Neopixel control. Now I'm left with the B6 pin, which is still alive but does not have SPI. Can I implement Neopixels protocol without the lib, using only CPU and hardcoded timings? I know that vanilla STM32 can do it. Is it possible on Espruino?

    I ordered new STM32's and I just want to localize the problem while they are being delivered.

Actions