Peripherals Tool: wrong SPI callback function template?

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

Peripherals Tool: wrong SPI callback function template?

Jump to solution
2,008 Views
danielholala
Senior Contributor II

Hi,

I think I found another "WTF?":

For the SPI driver, Peripherals Tool provides a callback function template:

danielholala_1-1646314737061.png

Select a Flexcomm instance and click on "Copy to clipboard".

This is what you'll get:

/* FLEXCOMM3 signal event callback function */
void SPI_SignalEvent(uint32_t event) {
  /* Master/Slave Transmit/Receive finished */
  if (event & ARM_SPI_EVENT_TRANSFER_DONE) {
    /* Place your code here */
  }
  /* Master/Slave Transmit/Receive incomplete transfer */
  if (event & ARM_SPI_EVENT_TRANSFER_INCOMPLETE) {
    /* Place your code here */
  }
  /* Address not acknowledged from Slave */
  if (event & ARM_SPI_EVENT_ADDRESS_NACK) {
    /* Place your code here */
  }
  /* Master lost arbitration */
  if (event & ARM_SPI_EVENT_ARBITRATION_LOST) {
    /* Place your code here */
  }
}

However, this does not compile as none of the "event macros" is defined.

The file Driver_SPI.h defines only:

/****** SPI Event *****/
#define ARM_SPI_EVENT_TRANSFER_COMPLETE (1UL << 0)  ///< Data Transfer completed
#define ARM_SPI_EVENT_DATA_LOST         (1UL << 1)  ///< Data lost: Receive overflow / Transmit underflow
#define ARM_SPI_EVENT_MODE_FAULT        (1UL << 2)  ///< Master Mode Fault (SS deactivated when Master)

These are the "official" SPI event macros as specified in the ARM template driver.

NXP, please fix this.

Thanks.
Best regards

Daniel

 

0 Kudos
1 Solution
1,128 Views
danielholala
Senior Contributor II

This issue seems to have been fixed.

I tested it with MCUXpresso IDE v11.7.0, the Peripherals Tool that came with it (version: 10.0.0.202301120728) and SDK_2.x_LPC5526 (v2.13.0).

View solution in original post

Tags (1)
0 Kudos
3 Replies
1,986 Views
Jan_Kucera
NXP Employee
NXP Employee

Hi Daniel,

Thank you for reporting this issue.

The SPI CMSIS driver component will be fixed in the nearest data update for the MCUXpresso configuration tools version 11.

Best Regards,

Jan Kucera.

1,129 Views
danielholala
Senior Contributor II

This issue seems to have been fixed.

I tested it with MCUXpresso IDE v11.7.0, the Peripherals Tool that came with it (version: 10.0.0.202301120728) and SDK_2.x_LPC5526 (v2.13.0).

Tags (1)
0 Kudos
1,997 Views
danielholala
Senior Contributor II

That's what the code should look like:

 

void SPI_SignalEvent(uint32_t event) {
  /* Master/Slave Transmit/Receive success */
  if (event & ARM_SPI_EVENT_TRANSFER_COMPLETE) {
    /* Place your code here */
  }
  /* Master/Slave Transmit/Receive transfer failed */
  if (event & ARM_SPI_EVENT_DATA_LOST) {
    /* Place your code here */
  }
  /*  ARM_SPI_EVENT_MODE_FAULT
   * is not supported by SDK CMSIS driver implementation
   * see s_SPIDriverCapabilities in fsl_spi_cmsis.c */
}

 

 

I wonder whether I'm the first one to complain about this. Is nobody else using Peripherals Tool?