2021-07-19 06:42 AM
I'm new to ST-Micro controller, I m using STM32F429. I'm Receiving 8 bytes of data from SPI1 Port and transmitting the same data thru UART2 port to view in serial terminal. I m not supposed to view the HEX data. It is giving either ASCII or Unicode. How can I convert the data in microcontroller itself.
/* USER CODE BEGIN PV */
uint8_t ReadData[8]; // declared as global variable
void StartReceive(void)
{
HAL_SPI_Receive(&hspi1,&ReadData[0],8,100);
HAL_UART_Transmit(&huart2,&ReadData[0],8,100);
}
In oscilloscope, I can verify the binary format data. There is no more problem in Clock, Data line, And Hardware NSS pin and all. I can probe all those lines outside.
When I saw the data in debug mode also It shows some characters only. If any one helps me in this, it will a great thing for me.
Is there any format conversion does I have to do? or whether my declaration should be a character type?
2021-07-19 07:27 AM
The STM32 just receives/sends raw data. It doesn't know or care if you interpret the raw data as ASCII or Unicode. That is something you would need to control on the receiving software, there is no way for the STM32 to control this.
Converting unicode to ASCII is nontrivial as there are way more than 127 Unicode characters. They don't all have ASCII equivalents.