s32k116 flexio spi & lpspi error callback

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

s32k116 flexio spi & lpspi error callback

Jump to solution
663 Views
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 Kudos
1 Solution
628 Views
Senlent
NXP TechSupport
NXP TechSupport
0 Kudos
3 Replies
645 Views
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 Kudos
642 Views
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 Kudos
629 Views
Senlent
NXP TechSupport
NXP TechSupport

Senlent_0-1672217679290.png

 

0 Kudos