cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMx HAL_SPI_Receive ?

antonius
Senior
Posted on October 06, 2015 at 23:59

Guys,

I want to send a command and then retrieve the output on MOSI line ... Is the right way doing it ?

int resultvalue = 0;
uint8_t data7[2] = { VS_READ_COMMAND, addressbyte };
HAL_SPI_Transmit(&hspi1,data7,2,1000);
then :
uint8_t data8[1] = {0x00}; <=== is it declared properly ?
resultvalue = HAL_SPI_Receive(&hspi1,data8,1,1000);
resultvalue <<= 8;
resultvalue += HAL_SPI_Receive(&hspi1,data8,1,1000);
return resultvalue;

Thanks a lot
21 REPLIES 21
antonius
Senior
Posted on October 28, 2015 at 13:13

I calculate :

34832

(decimal) = 0x8810(hex)... So it's doing the job correctly ( SPI bus ) .... Why isn't working yet ??
antonius
Senior
Posted on November 28, 2015 at 05:13

Does SPI speed matter ?