2016-05-18 01:44 PM
Hello,
We want to use HAL_SPI_Transmit function to load the data from 16 bit Array. The function parameters are (SPI_Handle TypeDef *hspi, uint8_t * pdata, uint16_t Size, uint32_t Timeout). Our data buffer is defined as following: uint16_t DotRowBuff[24] When we call above Transmit function, the pointer is uint8_t type and our data buffer is 16 bit. So can we not have 16 bit data pointer in this function? Or how can we define 8 bit pointer that will give the address of 16-bit array? We are referring to UM1785 which gives the description of HAL drivers. Please advise.2016-05-23 08:36 AM
Hi adeshra.vimmi,
The data frame long may be configured to 8 bits or 16 bits (DFF). That is why HAL_SPI_Transmit takes 8 bit pointer as parameter.In the implementation of this function, the behavior will depend on the selected data frame length (SPI_DATASIZE_16BIT or SPI_DATASIZE_8BIT).In your case, it should be set to SPI_DATASIZE_16BIT.-Mayla-To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2016-05-23 01:58 PM
Thanks Mayla.
I have specified DataSize as SPI_DataSize_16bit. But how do I assign the 8-bit data pointer to 16-bit data buffer? The data buffer and data pointer are defined as following: uint16_t DotRowBuff[24]; uint8_t *DotRowPtr; I want to assign DotRowPtr to DotRowBuff? How can I implement this?2016-05-24 08:01 PM
You can just type-cast it to the desired type.
DotRowPtr = (uint8_t *) DotRowBuff;