s32k116 flexio spi & lpspi error callback

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

s32k116 flexio spi & lpspi error callback

跳至解决方案
1,255 次查看
buccno
Contributor III

Hi,
how can I know if spi communication(interrupt mode) is an error?

For example CAN has, 

typedef void (*flexcan_error_callback_t)(uint8_t instance, flexcan_event_type_t eventType,                                          flexcan_state_t *flexcanState);

and, has this enum,

typedef enum {
FLEXCAN_EVENT_RX_COMPLETE,     /*!< A frame was received in the configured Rx MB. */     FLEXCAN_EVENT_RXFIFO_COMPLETE, /*!< A frame was received in the Rx FIFO. */     FLEXCAN_EVENT_RXFIFO_WARNING,  /*!< Rx FIFO is almost full (5 frames). */     FLEXCAN_EVENT_RXFIFO_OVERFLOW, /*!< Rx FIFO is full (incoming message was lost). */     FLEXCAN_EVENT_TX_COMPLETE,     /*!< A frame was sent from the configured Tx MB. */ #if FEATURE_CAN_HAS_WAKE_UP_IRQ
FLEXCAN_EVENT_WAKEUP_TIMEOUT,  /*!< An wake up event occurred due to timeout. */     FLEXCAN_EVENT_WAKEUP_MATCH,    /*!< An wake up event occurred due to matching. */     FLEXCAN_EVENT_SELF_WAKEUP,     /*!< A self wake up event occurred. */ #endif /* FEATURE_CAN_HAS_WAKE_UP_IRQ */ #if FEATURE_CAN_HAS_DMA_ENABLE     FLEXCAN_EVENT_DMA_COMPLETE,   /*!< A complete transfer occurred on DMA */     FLEXCAN_EVENT_DMA_ERROR,      /*!< A DMA transfer fail, because of a DMA channel error */
#endif /*
FEATURE_CAN_HAS_DMA_ENABLE */    
FLEXCAN_EVENT_ERROR
} flexcan_event_type_t;

but flexio spi only has,

typedef enum {

    SPI_EVENT_END_TRANSFER = 0  

  } spi_event_t; /* Callback for all peripherals which supports SPI features */

typedef void (*spi_callback_t)(void *driverState, spi_event_t event, void *userData);

0 项奖励
回复
1 解答
1,220 次查看
Senlent
NXP TechSupport
NXP TechSupport
0 项奖励
回复
3 回复数
1,237 次查看
Senlent
NXP TechSupport
NXP TechSupport

Hi@buccno

  User can judge whether an error occurs during the transmission process according to the returen value of the API.

For your reference.

Senlent_0-1672212974720.png

 

0 项奖励
回复
1,234 次查看
buccno
Contributor III

I got it I could use this return value for lpspi, but for the flexio spi, how can I write the callback function and functions parameter?

In s32DS 

buccno_0-1672215342227.png
I cannot change it because its type is const. (I think that's why you made an error)

buccno_1-1672215481514.png

 

0 项奖励
回复
1,221 次查看
Senlent
NXP TechSupport
NXP TechSupport

Senlent_0-1672217679290.png

 

0 项奖励
回复