How use scb to trig pdma

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
ssdgf
Level 1
Level 1
First solution authored First reply posted 5 sign-ins

Hi,

    I have more than 256 bytes to transmit out via uart. I check the example code in SDL, which triggers the pdma with sw, the fifo is 128 byte in deep, then it can only send  129 bytes after sw triggering. So i want to trig the pdma move one byte to fifo every time the scb send one byte out. Below is my code:

cy_en_scb_uart_status_t retStatus = CY_SCB_UART_BAD_PARAM;
uint32_t scb_index = ((uint32_t)base - SCB0_BASE) / 0x10000ul;

if(scb_index < SCB_NUM_MAX)
{
cy_stc_pdma_descr_config_t dw1ChUartTxConfig =
{
.deact = 0ul,
.intrType = CY_PDMA_INTR_DESCR_CMPLT,
.trigoutType = CY_PDMA_TRIGOUT_1ELEMENT_CMPLT,
.chStateAtCmplt = CY_PDMA_CH_DISABLED,
.triginType = CY_PDMA_TRIGIN_1ELEMENT,
.dataSize = CY_PDMA_BYTE,
.srcTxfrSize = 0ul, // same as "dataSize"
.destTxfrSize = 1ul, // 32bit width
.descrType = CY_PDMA_1D_TRANSFER,
.srcAddr = (void *)(src_buffer),
.destAddr = (void *)&base->unTX_FIFO_WR.u32Register,
.srcXincr = 1ul,
.destXincr = 0ul,
.xCount = tx_num,
.descrNext = NULL
};

cy_stc_pdma_chnl_config_t dwUartTxConfig =
{
.PDMA_Descriptor = &dwUartTxDescr[scb_index],
.preemptable = 0ul,
.priority = 0ul,
.enable = 1ul,
};

/* Initialize & Enable DMA */
Cy_PDMA_Disable(pstcPDMA);
Cy_PDMA_Chnl_DeInit(pstcPDMA, chNum);
Cy_PDMA_Descr_Init(&dwUartTxDescr[scb_index], &dw1ChUartTxConfig);
Cy_PDMA_Chnl_Init(pstcPDMA, chNum, &dwUartTxConfig);
Cy_PDMA_Chnl_Enable(pstcPDMA, chNum);
Cy_PDMA_Chnl_SetInterruptMask(pstcPDMA, chNum);
Cy_PDMA_Enable(pstcPDMA);

Cy_TrigMux_Connect1To1(trigLine, 0ul, TRIGGER_TYPE_LEVEL, 0ul);

Cy_SCB_UART_PutArray(base, &src_buffer[0], 1ul);
/* SW Trigger */
//Cy_TrigMux_SwTrigger(trigLine, TRIGGER_TYPE_EDGE, 1ul);

retStatus = CY_SCB_UART_SUCCESS;
}

The "trigLine" above is TRIG_OUT_1TO1_2_SCB_TX_TO_PDMA10.

My setup:

cyt4bf8, scb0_tx, pdma 1;

My code can only send out the first byte of buffer, so i thought the pdma input trigger failed. 

How to modify it?

Regards.

 

0 Likes
1 Solution
ssdgf
Level 1
Level 1
First solution authored First reply posted 5 sign-ins

I solved this yesterday,  just set the scb tx fifo entry level to 1ul, i set it to 0ul before.

View solution in original post

0 Likes
2 Replies
Apurva_S
Moderator
Moderator
Moderator
100 likes received 500 replies posted 250 solutions authored

Hi @ssdgf 

Please tell the SDL version that you are using.

Regards.

0 Likes
ssdgf
Level 1
Level 1
First solution authored First reply posted 5 sign-ins

I solved this yesterday,  just set the scb tx fifo entry level to 1ul, i set it to 0ul before.

0 Likes