Explanation of DMA, GPIO and memory

Hi all,

Has a detailed description been written on how the DMA controllers are used to clock out the data and how the memory is organised?

I could figure this out from the code, but was wondering if an article or blog post has been written explaining the DMA operations, how the clock and latch is done. How the brightness and LUT tables where developed?

EDIT: I am interested on a technical level, as i would like to understand and not just simply use the Library.

Best regards,
Andy

No, I haven’t written a technical description. Here’s some basics on the Teensy implementation:

  • The clock and data signals (and address starting with SmartLED Shield V4) are just stored in memory (including both the high and low of the CLK signal), and DMA moves the values from memory to GPIO
  • DMA is triggered by the latch signal
  • The latch signal and OE signals are controlled by a timer
  • There’s an additional DMA channel used to update the timer values as they change after every latch signal, for the different color depths
  • The data DMA channel is disabled after shifting out all the data for one row, and is reenabled in an ISR

I refactored the code in the teensylc branch on GitHub, it’s functionally identical but the data structures are organized in a less convoluted fashion. You may want to refer to that branch to better understand how the code works.

Hi Louis,

Thanks for the response and the library.

If you have time, I have a few other questions :slight_smile:

I can see that the bitmap is stored in memory in the usual format I.e. an array of uint8 / unit16 r, g, b values. Do you re-map the image to a new buffer for each row? If so when is this done? If not how does the remapping from image memory to dma work?

When scrolling text or adding shapes etc, is this done on the in memory bitmap array or at the mapping and dma level?

Is there a way I can donate to the project, other than buying v4 boards.

Thanks for your response,
Andy

Do you re-map the image to a new buffer for each row? If so when is this done?

For the Teensy, each time a row is refreshed, the loadMatrixBuffers() function pulls data from the stacked layers (e.g. background, scrolling text), and combines them, then stores the pixels to be displayed in the exact order/arrangement they need to be shifted out to the GPIO pins.

When scrolling text or adding shapes etc, is this done on the in memory bitmap array or at the mapping and dma level?

It’s stored in the bitmap arrays

Is there a way I can donate to the project, other than buying v4 boards.

I have a PayPal link here, thanks!

Donate to Pixelmatix