AnsweredAssumed Answered

About DMA IN I2C How is it used in communications

Question asked by xin tu on Jun 10, 2018
Latest reply on Sep 26, 2018 by 玉敏111 田
  • The SDK version I used was 0.8.6 

  •  compilation tool: S32 Design Studio for ARM v2.0

I can use interrupt mode to trigger I2C to send and receive data normally, and cannot send and receive data normally with DMA trigger.

 

const lpi2c_master_user_config_t lpi2c0_MasterConfig0 = {
  .slaveAddress = 105U,
  .is10bitAddr = false,
  .operatingMode = LPI2C_FAST_MODE,
  .baudRate = 400000U,
  .transferType = LPI2C_USING_DMA,
  .dmaChannel = 0U,
  .masterCallback = NULL,
  .callbackParam = NULL,
};

 

/***************************************************************************
* Function Name  :vsysBoardInit
* Auther       : tuxin
* Dat            : 2018_05_21
* Description    : 初始化系统参数入口函数
* Input   : None
* Output         : None
* Return         : None
****************************************************************************/
static void vsysBoardInit(void)
{
 /*配置系统时钟*/
 CLOCK_SYS_Init(g_clockManConfigsArr, CLOCK_MANAGER_CONFIG_CNT,
                      g_clockManCallbacksArr, CLOCK_MANAGER_CALLBACK_CNT);
   CLOCK_SYS_UpdateConfiguration(0U, CLOCK_MANAGER_POLICY_AGREEMENT);
 /*配置管脚信息*/
 PINS_DRV_Init(NUM_OF_CONFIGURED_PINS, g_pin_mux_InitConfigArr);
 
 /*配置串口信息*/
 vusartInit();
 
 /*配置can信息*/
 vcanInit();
 /*配置I2C信息*/
 LPI2C_DRV_MasterInit(INST_LPI2C0, &lpi2c0_MasterConfig0, &lpi2c0MasterState); 
 INT_SYS_SetPriority( LPI2C0_Master_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY ); 
 /*配置SPI信息*/
 LPSPI_DRV_MasterInit(SPI_INSTANCE, &lpspi2Com1State, &lpspi2Com1_MasterConfig0);
 INT_SYS_SetPriority( LPSPI2_IRQn   , configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
 #if 0 // tuxin 20180508
 /*配置系统看门狗信息*/
 INT_SYS_InstallHandler(WDOG_EWM_IRQn, CU_Sys_WDOG_ISR, (isr_t *)0);
 /* Enable Watchdog IRQ */
 INT_SYS_EnableIRQ(WDOG_EWM_IRQn);
 INT_SYS_SetPriority( WDOG_EWM_IRQn , configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
 /* Initialize WDOG */
 WDOG_DRV_Init(INST_WATCHDOG1, &watchdog1_Config0);
 #endif
 
 /*配置lptmr0信息*/
 /* Init LPTMR as timer
 *  -   interrupt after 10ms
 *  -   SIRC as clock source
 *  -   counter disabled
 */
 LPTMR_DRV_Init(INST_LPTMR0, &lpTmr0_config0, false);
 /* Install IRQ handler for LPTMR interrupt */
 INT_SYS_InstallHandler(LPTMR0_IRQn, &vsyslptmrISR, (isr_t *)0);
 /* Enable IRQ for LPTMR */
 INT_SYS_EnableIRQ(LPTMR0_IRQn);
 /* Start LPTMR counter */
 LPTMR_DRV_StartCounter(INST_LPTMR0);
 INT_SYS_SetPriority( LPTMR0_IRQn   , configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
 /* Initialize RTC instance
  *  - See RTC configuration component for options
  */
 RTC_DRV_Init(RTCTIMER, &rtcTimer_Config0);
 /* Configure RTC Time Seconds Interrupt */
 //RTC_DRV_ConfigureSecondsInt(RTCTIMER, &rtcTimer_SecIntConfig0);
 /* Set the time and date */
 RTC_DRV_SetTimeDate(RTCTIMER, &rtcTimer_StartTime0);
 /* Start the RTC counter */
 RTC_DRV_StartCounter(RTCTIMER);
}

 

Outcomes