Efficient lookup table implementation with DMA?

cancel
Showing results for 
Search instead for 
Did you mean: 

Efficient lookup table implementation with DMA?

561 Views
scottm
Senior Contributor II

I find that I'm frequently running data through a lookup table just prior to sending it out to a peripheral via DMA - for example, to handle gamma correction or to convert PCM samples to pulse density modulation bit patterns.  Is there a way to have the Kinetis eDMA controller do this efficiently on its own?

I'm fairly certain a DMA-based lookup table is possible, using linked channels with one channel loading source data into the low byte(s) of another's SADDR register.  I'm not certain if the hardware allows one channel to directly access another's TCD or if it'd have to use scatter/gather mode and reload the modified TCD from system RAM, but at best that's going to require two DMA requests per source word.

The ability to do this as part of the normal DMA request process would be tremendously useful for data transformation like the examples above and for emulating other hardware interfaces, for example to use an I2S port to transmit asynchronous data by setting the transmitter for a 10-bit word size and using a lookup table to convert a buffer of 8-bit data into 10-bit sequences with start and stop bits.

Thanks,

Scott

Labels (1)
Tags (2)
0 Kudos
3 Replies

143 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi Scott,

I am quite concern the data transformation efficiency using eDMA module with this kind of application.

The eDMA transfer data is byte format, if just using eDMA module to do 8-bit byte data convert to 12-bit data seems quite complicate. Even using the lookup table, there need to know the data index at the lookup table. You can using the scatter/gather mode to dynamic configure the TCD value. While it need to know the data info and set the correct lookup table index before the eDMA start transfer. I don't think using DMA will reduce the time for this kind of application.


Have a great day,
Ma Hui

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

143 Views
scottm
Senior Contributor II

It took me most of a year to get around to trying it, but I got it working today.  I've posted a more detailed explanation in this forum.  It's probably not super efficient, but in this case I think it's not using more than a few tens of thousands of transfers per second and the RAM saved is worth it.

0 Kudos

143 Views
scottm
Senior Contributor II

Yeah, it seems like it might be kind of horrendous as it is now.  I could see using it if the CPU absolutely needs to be free for other things or there's not enough RAM for the expanded version of the data, and particularly if the bus traffic can be kept from interfering with whatever else is going on.

Indexed modes would be something really nice to have in a future version of the eDMA module, though.  One can wish...

Thanks,

Scott

0 Kudos