The sample code provided is to read the data of 3 channels;
The problem I encountered when using this chip: It is no problem to read only one channel. If continuous reading>=2 channels, the channel data will be staggered. For example, the code is written to read channel A, but it is actually channel B data. If it is a 4-channel continuous reading, it seems that A reads B, B reads C, C reads D, and D reads A, which is similar to this stagger.
After the code is written, I will actually read the data for debugging and correct the misplaced data.
The following is the source code:
In the HAL library mode, the "DATASIZE" of SPI is configured as 16bit. There is a problem. The parameter type of the SPI operation function HAL_SPI_TransmitReceive() in the HAL library is "uint8_t", but the byte length of the SPI configuration is 16bit. How to do?
There are two methods. One is to directly modify the HAL library package function and change the parameter type to uint16_t. I am confused when I change it. Try not to change the package source code. This method is not recommended; the other is to force the type, although the parameter The transfer is based on uint8_t, but the SPI function finally gives you the complete uint16_t type data