cancel
Showing results for 
Search instead for 
Did you mean: 

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

ASchu.4
Associate II

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 discussion is locked. Please start a new topic to ask your question.
1 ACCEPTED SOLUTION

Accepted Solutions
Ulysses HERNIOSUS
ST Employee

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

View solution in original post

1 REPLY 1
Ulysses HERNIOSUS
ST Employee

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