2017-12-09 03:46 AM
Hello everybody,
I need to write some registers of an integrated circuit connected to an STM32F407VG MCU by the SPI2 line.
I found these two functions:
-SPI_I2S_ReceiveData()
-SPI_I2S_SendData()
which documentation can be found at
I just didn't get how to tell the function which register I want to write to, since the SPI_I2S_SendData() accepts only 2 parameters: SPI line number (e.g. SPI1, SPI2, SPI3) and the data to be transmitted.
Any help is highly appreciated.
Thank you,
best regards,
Lorenzo
#register #spi #firmware #dataSolved! Go to Solution.
2017-12-09 10:16 AM
Lorenzo Estienne wrote:
I just didn't get how to tell the function which register I want to write to, since the SPI_I2S_SendData() accepts only 2 parameters: SPI line number (e.g. SPI1, SPI2, SPI3) and the data to be transmitted.
That's because SPI has no definition of 'registers' or 'addresses' - it's all just data.
It's only your mystery '
integrated circuit' that assigns meaning to those bytes.
As ​ (or is it ​) says, you'll have to study the datasheet of your mystery '
integrated circuit' to find the required format for the data ...
2017-12-09 04:35 AM
Read the external chip's datasheet. It should tell you what data to send in order to write to its registers.
JW
2017-12-09 10:16 AM
Lorenzo Estienne wrote:
I just didn't get how to tell the function which register I want to write to, since the SPI_I2S_SendData() accepts only 2 parameters: SPI line number (e.g. SPI1, SPI2, SPI3) and the data to be transmitted.
That's because SPI has no definition of 'registers' or 'addresses' - it's all just data.
It's only your mystery '
integrated circuit' that assigns meaning to those bytes.
As ​ (or is it ​) says, you'll have to study the datasheet of your mystery '
integrated circuit' to find the required format for the data ...
2017-12-09 12:43 PM
Thank you both!
I firstly had to use the SPI_I2S_SendData() function to select the register, and THEN use it again to tell the data I wanted to write on the register I previously chosen.
2017-12-09 12:54 PM
I've created a function that takes as arguments the SPI line, the register, and the data that I want to write.
Then this function executed the SPI_I2S_SendData() twice.
2017-12-09 01:52 PM
are you sure you couldn't do it all in one?