S32K148 - DMA for ENET 1588 Timers

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S32K148 - DMA for ENET 1588 Timers

1,303 Views
jakub_mielczare
Contributor III

Hello,

The s32k chip has 4x 1588 timer which can capture 1588 time when an external event (edge of an external signal) occurs.

As I understand, the captured timestamps can be read either via SW or by DMA.

Suppose I want to use DMA to read the timestamps and place them in a buffer. Suppose I want to use 2 timers, each of them for different event, and each serviced by different DMA channel. How do I configure each DMA channel to use the particular timer as a trigger source?

Thank you,

Jakub

Tags (2)
0 Kudos
Reply
3 Replies

1,088 Views
veronicavelciu
NXP Employee
NXP Employee

Hello Jakub,

I recommend using S32 Design Studio for ARM together with the S32 SDK. You can start from the enet_loopback example and you will be able to configure the pins and the ENET timer through the graphical interface. In order to enable the DMA request for your timer channel, you will need to configure ENET and DMA as follows:

pastedImage_1.png

pastedImage_2.png

 

The code initialization sequence should look like this:

uint32_t buffer[100];

ENET_DRV_Init(INST_ETHERNET1, &ethernet1_State, &ethernet1_InitConfig0, ethernet1_buffConfigArr0, ethernet1_MacAddr);

ENET_DRV_TimerInit(INST_ETHERNET1, &ethernet1_TimerInitConfig);

ENET_DRV_TimerEnableChannel(INST_ETHERNET1, 0U, &ethernet1_ChannelInitConfig0);

EDMA_DRV_Init(&dmaController1_State, &dmaController1_InitConfig0, edmaChnStateArray, edmaChnConfigArray, EDMA_CONFIGURED_CHANNELS_COUNT);

EDMA_DRV_ConfigMultiBlockTransfer(0U, EDMA_TRANSFER_PERIPH2MEM, (uint32_t)(&(ENET->CHANNEL[0].TCCR)), (uint32_t)(buffer), EDMA_TRANSFER_SIZE_4B, 4U, 100U, true);

EDMA_DRV_StartChannel(0U);

ENET_DRV_TimerStart(INST_ETHERNET1);

There is only one DMA request for all the timer channels.

Best regards,

Veronica

0 Kudos
Reply

1,088 Views
jakub_mielczare
Contributor III

Hello  Veronica,

"There is only one DMA request for all the timer channels" - so does it mean that if I have two timers in capture mode, each with different signal, then DMA request for both DMA channels will be triggered whenever any of the two captures takes place? I suppose I can configure the 2 DMA channels to use different timer registers for reading the captured timestamp. But how does triggering the right DMA channel work in this case?

Best regards,

Jakub

0 Kudos
Reply

1,088 Views
alexb
NXP Employee
NXP Employee

Hello Jakub,

The four timer channels are wired to a single DMA request, thus the DMA channel isn't able to distinguish which timer channel triggers the request.

Option 1: Use software interrupts to have the desired event identification.

Option 2: Use DMA if you wish to copy (any number of) timer channel registers to the desired buffer without direct event identification.

Best regards,

Alexandru

0 Kudos
Reply