Issue with digitalPulse

Posted on
  • Board doesn't send pulses with duration less than 1us. As far as I understand that's a deal with prescaling mcu frequency.
    Found ur post with examples of how to access a timer, but I feel like it's only about PWM, therefore not not what I need. Can anyone answer is it even possible to change min pulse duration?

  • Which board are you using? All your other questions seem to have been about ESP32.

    Do you want to output just a single pulse? If you do have an STM32-based board likle in https://www.espruino.com/STM32+Periphera­ls I believe you should be able to set the timer not to auto-reload, in which case it'll just do one pulse.

    ... or you can maybe use SPI - put the pulse (or pulses) you want as bits in an array, and then just use SPI to send the array and the pulses will appear on the MOSI line

  • I work with different boards and have certain struggles with STM-based (mine is that one with STM32F411).
    I had tried to control WS2812 using digitalPulse, but the experiment has showed that board doesnt perform pulses with duration around (0.3-1us).
    Neopixel works great but I dont like that on stm boards it implicitly setups hardware spi bus. I'm wondering if using low-level timer control allows me to avoid using hardware spi (like RMT module on ESP32 does). U see that I do not consider SPI as a solution. Perhaps I would do so if it was possible to configure soft bus baudrate.

    Anyway, now it's a question not really about ws2812, but how to make digitalPulse work with impulses I need.

  • mine is that one with STM32F411

    Are you saying in a roundabout way you have an IskraJS board, or at least not an official Espruino board?

    I don't think digitalPulse will do what you need, even if it could output small enough pulses. You need the gap between them to be small too, and so to power neopixels you'd need it to be able to run through an array of 48 floating point items for every single neopixel - I don't think digitalPulse would be fast enough even if the timer was set up to handle it.

    If this is just about neopixels and you not wanting to use an SPI line, check out trying to compile Espruino with this code built in: https://github.com/espruino/Espruino/blo­b/master/libs/neopixel/jswrap_neopixel.c­#L135-L141

    For the WIO LTE the neopixel wasn't on an SPI pin and so there needed to be a software-only solution, which works for STM32: https://github.com/espruino/Espruino/blo­b/52352efac4f8f40976a4d268a0a074ad15251b­29/targets/stm32/stm32_ws2812b_driver.c#­L12

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Issue with digitalPulse

Posted by Avatar for Nicktonious @Nicktonious

Actions