Peripherals Tool: wrong SPI callback function template?

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

Peripherals Tool: wrong SPI callback function template?

跳至解决方案
3,215 次查看
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 项奖励
回复
1 解答
2,335 次查看
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).

在原帖中查看解决方案

标记 (1)
0 项奖励
回复
3 回复数
3,193 次查看
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.

2,336 次查看
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).

标记 (1)
0 项奖励
回复
3,204 次查看
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?