T4.1 - QuadTimers controlling DMA from (16) GPIOs connected to Ethernet via XBAR ?

Status
Not open for further replies.

nmz787

Member
Hi,
I'm working on a project where I need to sample (16) ADCs that report their data via SPI. The target sample rate is 100ksps, with (16) channels and 16-bits per sample, that's 3.2MBPS.

The ADCs only need SCK and MISO, they aren't programmed via MOSI, rather a conversion from analog to digital is started with a "start capture" pin.
The idea is to tie all (16) SCK and START together, to two pins respectively, and hook them each up to their own timer to emit the (faster) SCK and (slower) START signals. A 3rd timer would start the other two, so the GPIO edges are synchronized.

The 16 MISO signals would each be connected to their own GPIOs.

Now here's where I start to get "hand wavy". Basically I want the CPU to be idle while a 4th timer (also started by the 3rd, in sync with the SCK and START GPIOs) periodically is started, and then stops running after (16) ticks. On each tick, the GPIO MISO pins would be captured and input into DMA channels, and sent to either the SD card or the Ethernet.
I say OR because I think sending it to an SD card will be easier, but I really want these data to get sent to a server with a big hard-drive. I'm just thinking in terms of staging this development.


Does anyone have any suggestions? Any code/libraries out there to help any of these pieces?


Do I connect the GPIOs to the XBAR and then to the DMA data-source? Connecting the DMA to it's data sink, and then to the timer is a little less blurry for me... but the whole getting it pumped out of the Ethernet (to a specific IP address) is not really too clear. Do I setup some template packet, and the DMA/Ethernet event packs the input into some data field to be sent out? Will this be UDP? I don't want to lose samples, so can I do TCP (since it offers retransmission)?

Thanks!

P.S. I've already got an Ethernet demo running with vjmusik's FNET and NativeEthernet library combo... I wonder if that will conflict with trying to shove data at the interface via DMA. Will my use of timers mess with it?
 
Last edited:
Personally I couldn't tell you what works and doesn't work with my libraries, hopefully it doesn't conflict with anything, but I've never done any work with DMA or XBAR and very little with timers in general so I don't even know where to start to even get an example working that I could probe for problems. If you do run into any problems I would like to get a bare minimum sketch that I can reproduce the issue with so I can find anything that's causing issues in my library and fix them. You shouldn't have any problems using TCP for this as long as you give it a static ip so the computer knows where it's at, FNET does have MDNS/Bonjour built in, but I haven't added an easy way to make use of it in my NativeEthernet library yet.
 
Alright I added the MDNS part in to my library so now you can use a .local address instead of a static ip.
 
Here's a subset of the table (Table 10-1. Muxing Options) in the RT1060 Reference Manual (chapter 10.1.1 Muxing Options), with an added column for the Teensy 4.1 pins
Instance Port Pad Mode Teensy pin
TMR1 (QUAD TIMER)TMR1_TIMER0 GPIO_B0_00 ALT1 10
TMR1_TIMER1 GPIO_B0_01 ALT1 12
TMR1_TIMER2 GPIO_B0_02 ALT1 11
TMR1_TIMER3 GPIO_B1_08 ALT1 *
TMR2 (QUAD TIMER)TMR2_TIMER0 GPIO_EMC_19 ALT4 *
GPIO_B0_03 ALT1 13
TMR2_TIMER1 GPIO_EMC_20 ALT4 *
GPIO_B0_04 ALT1 *
TMR2_TIMER2 GPIO_EMC_21 ALT4 *
GPIO_B0_05 ALT1 *
TMR2_TIMER3 GPIO_EMC_22 ALT4 51
GPIO_B1_09 ALT1 *
TMR3 (QUAD TIMER)TMR3_TIMER0 GPIO_AD_B1_00 ALT1 19
GPIO_EMC_15 ALT4 *
GPIO_B0_06 ALT1 *
TMR3_TIMER1 GPIO_AD_B1_01 ALT1 18
GPIO_EMC_16 ALT4 *
GPIO_B0_07 ALT1 *
TMR3_TIMER2 GPIO_EMC_17 ALT4 *
GPIO_AD_B1_02 ALT1 14
GPIO_B0_08 ALT1 *
TMR3_TIMER3 GPIO_B1_10 ALT1 *
GPIO_AD_B1_03 ALT1 15
GPIO_EMC_18 ALT4 *
TMR4 (QUAD TIMER)TMR4_TIMER0 GPIO_B0_09 ALT1 *
TMR4_TIMER1 GPIO_B0_10 ALT1 6
TMR4_TIMER2 GPIO_B0_11 ALT1 9
TMR4_TIMER3 GPIO_B1_11 ALT1 *
 
Status
Not open for further replies.
Back
Top