AnsweredAssumed Answered

Send 16 bit number with SPI and HAL library

Question asked by vugs.michel.001 on Oct 12, 2015
Latest reply on Oct 6, 2016 by barton.michael
Hello

I'm trying to send a 16 bit number with the SPI peripheral on a STM32F030 with the new HAL libary. Sending an 8 bit value is very easy but with a 16 bit number I receive errors or the hardware is crashing with a hardfault error.

void Rfm69_Write_Reg(uint8_t address, uint8_t value)
{
  reg[0] = value;
  reg[1] = address | 0x80;
     
  HAL_SPI_Transmit(&hspi1, (uint8_t *)reg, 1, 1000);   
}

This is the function i'm trying to implement now. But I always get a hardfault error when this function is executed. I do set the STM32 hardware for 16 bit using the CUBEMX software

Outcomes