Peripherals Tool: wrong SPI callback function template?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Peripherals Tool: wrong SPI callback function template?

ソリューションへジャンプ
3,210件の閲覧回数
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,330件の閲覧回数
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,188件の閲覧回数
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,331件の閲覧回数
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,199件の閲覧回数
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?