S32k: Use the LPUART and LSPI by DMA Channel at the same time, it cause the reset issue

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

S32k: Use the LPUART and LSPI by DMA Channel at the same time, it cause the reset issue

432 Views
ZhanCheng
Contributor I

Hi Helper,

I have a issue about  when i use the LPUART and LSPI by DMA at the same time, ErikaOs(RTOS) cause the system HW fault error after transmit spi data and uart data for several minutes.

I did some research on this issue:

1. Deactive the spi transmit function,  the error is disappered.

2. Change the DMA  channel prority to be the same level, the error is still exsit.

3. Change the DMA  channel prority to be the Round Robbin mode, the error is still exsit.

4. Enlarge the system stack and  all task stack, the error is still exsit.

5. Change the LPUART transmit mode to be interrput method, the error is disappered.

 

I suspect that the problem exsit in the DMA accessing the BUS causes some conflcits.

I try to find the sample in the SDK, but there is no sample about DMA channel used by different communication device at the same time. Helper, do you have some sample or opinion about this issue?

 

The below info is my config. Please check them.

The SDK version :

product: Peripherals v9.0
processor: S32K148
package_id: S32K148_LQFP144
mcu_data: s32sdk_s32k1xx_rtm_402
processor_version: 0.0.0

 

My LPUART config:

const uart_user_config_t LPUART0_0_uart_pal_config0 = {
.baudRate = 115200UL,
.parityMode = UART_PARITY_DISABLED,
.bitCount = UART_8_BITS_PER_CHAR,
.stopBitCount = UART_ONE_STOP_BIT,
.transferType = UART_USING_DMA,
.rxDMAChannel = 2UL,
.txDMAChannel = 3UL,
.rxCallback = Uart0CompleteRxTransfer,
.rxCallbackParam = NULL,
.txCallback = Uart0CompleteTxTransfer,
.txCallbackParam = NULL,
.extension = NULL
};

My SPI config:

/* LPSPI Slave Configurations 0 */

const lpspi_slave_config_t lpspi_2_SlaveConfig0 = {
.whichPcs = LPSPI_PCS0,
.pcsPolarity = LPSPI_ACTIVE_HIGH,
.bitcount = 8U,
.clkPhase = LPSPI_CLOCK_PHASE_1ST_EDGE,
.clkPolarity = LPSPI_SCK_ACTIVE_HIGH,
.lsbFirst = false,
.transferType = LPSPI_USING_INTERRUPTS,
.rxDMAChannel = 0U,
.txDMAChannel = 0U,
.callback = NULL,
.callbackParam = NULL
};

 

My EDMA config:

edma_chn_state_t * const edmaChnStateArray[] = {
&dmaController1Chn0_State,
&dmaController1Chn1_State,
&dmaController1Chn2_State,
&dmaController1Chn3_State,

};

edma_channel_config_t dmaController1Chn0_Config = {
.channelPriority = EDMA_CHN_PRIORITY_0,
.virtChnConfig = EDMA_CHN0_NUMBER,
.source = EDMA_REQ_LPSPI2_RX,
.callback = DMA_LPSPI2_RX_Notification,
.callbackParam = NULL,
.enableTrigger = false
};
edma_channel_config_t dmaController1Chn1_Config = {
.channelPriority = EDMA_CHN_PRIORITY_1,
.virtChnConfig = EDMA_CHN1_NUMBER,
.source = EDMA_REQ_LPSPI2_TX,
.callback = DMA_LPSPI2_TX_Notification,
.callbackParam = NULL,
.enableTrigger = false
};

#if 1
edma_channel_config_t dmaController1Chn2_Config = {
.channelPriority = EDMA_CHN_PRIORITY_2,
.virtChnConfig = EDMA_CHN2_NUMBER,
.source = EDMA_REQ_LPUART0_RX,
.callback = DMA_UART0_RX_Notification,
.callbackParam = NULL,
.enableTrigger = false
};
edma_channel_config_t dmaController1Chn3_Config = {
.channelPriority = EDMA_CHN_PRIORITY_3,
.virtChnConfig = EDMA_CHN3_NUMBER,
.source = EDMA_REQ_LPUART0_TX,
.callback = DMA_UART0_TX_Notification,
.callbackParam = NULL,
.enableTrigger = false
};
#endif

const edma_channel_config_t * const edmaChnConfigArray[] = {
&dmaController1Chn0_Config,
&dmaController1Chn1_Config,
&dmaController1Chn2_Config,
&dmaController1Chn3_Config,

};

const edma_user_config_t dmaController1_InitConfig0 = {
.chnArbitration = EDMA_ARBITRATION_ROUND_ROBIN,
.haltOnError = false
};

 

 

 

0 Kudos
0 Replies