waveform output for binary signals

Posted on
  • Hello guys!
    I would like to stream on a digital output at a given rate from a large file or array.
    I know the waveform class but it is dedicated to analog data. What is the best way to replicate the behaviour but for binary data?

    Thanks for your feedback

  • Good question :)

    At the moment it's best to use digitalPulse - this uses the same IRQ-based system of outputting data, you just have to pre-process the string of data into a series of pulse lengths.

    What kind of speed are you trying to achieve with it?

  • I would say as fast as possible :-)
    I wondered if I could output a stream at, let's say, fclk/2 or 42MHz ....

  • You couldn't get the data into it fast enough for that I'm afraid - for that kind of thing you'd be looking at writing your own C code and then maybe integrating that in to Espruino.

    It is possible to set up DMA directly from JavaScript, and you could for example stream from flash memory at that speed - but it'll require you reading the chip datasheet and poking around with registers.

  • It is possible to set up DMA directly from JavaScript

    By using peek/poke, or by another mean?

    I also think that the DMA should be a helful peripheral for that.
    With the current version of Espruino, what would you suggest for storing raw data stream in flash?

  • Yes, it'd just be using peek and poke.

    I'm not sure I understand the question? If you're using something like the Pico then there's a 128kB page at the end of flash that you can write the data into though.

  • Yes I'll be using the Pico.
    I'll have a look at the doc concerning this 128kB page.
    I may try to implement DMA functions in the near future. If anyone reading this message already played with the DMA in Espruino, I would appreciate to get any feedback :-)

  • In the Espruino repo you'll find scripts/build_js_hardware.js which'll work out some JS code with all the addresses and flags for the peripherals you specify in - it might make your life a bit easier :)

  • Thank you !

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

waveform output for binary signals

Posted by Avatar for Jean-Philippe_Rey @Jean-Philippe_Rey

Actions