cancel
Showing results for 
Search instead for 
Did you mean: 

WB55 Nucleo Board + I-NUCLEO-CN0216 Adapter on SPI 1

Hunhazy
Associate

Hi Everybody!

I'm trying to prototype a force measure application with SD-card on a P-NUCLEO-WB55 Board and I-NUCLEO-CN0216. I'm using the latest CubeIDE.

The SD Card work perfectly both on SPI 1 and SPI 2(In my project i'm using SPI 2 for the different Speed).

I'm trying to use the SPI 1 for I-NUCLEO-CN0216 adapter board.

After Hardware setup with CubeIDE and adding a code for testing with HAL librarys, that just read out the ADC Mode register, the HAL_SPI_Receive() function returns with HAL_ERROR status and 0x00 for the Register data.

I trying all the SPI mode's etup.

I trying all the 3 different SPI CS pin on the adapterboard.

All the boards power up from Vin pin with 12V.

I attach picture from the SPI 1 Setup and from the added code.

Someone already had similar problem?

Can somebody help me?

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

Your HAL_SPI_Transmit call is nonsense. You need to pass a pointer to the data, not a random pointer to whatever data happens to be at address 0x18.

uint8_t data = 0x18;
HAL_SPI_Transmit(&hspi1, &data, 1, 100);

You don't show what ADC_Register_Read is, but probably a similar issue there.

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

3 REPLIES 3
MM..1
Chief II

Maybe you need measure your SPI signals on AD with scope.

TDK
Guru

Your HAL_SPI_Transmit call is nonsense. You need to pass a pointer to the data, not a random pointer to whatever data happens to be at address 0x18.

uint8_t data = 0x18;
HAL_SPI_Transmit(&hspi1, &data, 1, 100);

You don't show what ADC_Register_Read is, but probably a similar issue there.

If you feel a post has answered your question, please click "Accept as Solution".

Thank you very much, you were right. I'm using wrong variables, ADC_Register_Read was uint8_t *. I changed the code with according to your recommendation and it works fine.