Skip to main content
ASchu.4
Associate II
October 12, 2018
Solved

How to migrate project NFC5 v1.3 polling from STM43F401 to STM32F072?

  • October 12, 2018
  • 1 reply
  • 938 views

I generated a new cube project, included everything what nfc reader needed(like the sample project for 401), I modified the platform.h, the SPI is working, but its a bit confusing, because if I use HSI the reading is freezing in demoPollNFCA() - without any card. If I use the 072 with 48Mhz HSI the polling works fine but if i put a card in front of the reader I get a hardfault ISR..

So the ST25 init  succeeded, the SPI and the interrupts are working. Maybe there is some problem with timings, (like NFC's GP or SW IT..)

This topic has been closed for replies.
Best answer by Ulysses HERNIOSUS

Hi,

you are most likely hit by a limitation of the STM32F0 HAL SPI drivers: They cannot operate on non-16-bit aligned 8-bit pointers. To completely verify please set USE_FULL_ASSERT to 1...

As solution I can only recommend tweaking the HAL driver, by e.g.

<< *((uint16_t *)pRxData) = hspi->Instance->DR;

>> uint16_t temp;

 >> temp = hspi->Instance->DR;

 >> *((uint8_t *)pRxData) = temp & 0xff;

 >> *(((uint8_t *)pRxData)+1) = temp >> 8;

This shows only receiving side, similar for sending side.

Regards, Ulysses

1 reply

Ulysses HERNIOSUS
ST Technical Moderator
October 15, 2018

Hi,

you are most likely hit by a limitation of the STM32F0 HAL SPI drivers: They cannot operate on non-16-bit aligned 8-bit pointers. To completely verify please set USE_FULL_ASSERT to 1...

As solution I can only recommend tweaking the HAL driver, by e.g.

<< *((uint16_t *)pRxData) = hspi->Instance->DR;

>> uint16_t temp;

 >> temp = hspi->Instance->DR;

 >> *((uint8_t *)pRxData) = temp & 0xff;

 >> *(((uint8_t *)pRxData)+1) = temp >> 8;

This shows only receiving side, similar for sending side.

Regards, Ulysses