01-04-2024 05:08 AM
Hello i am doing a project that includes data data acquisition, i am using ICM20948 sensor for gyroscope, accelerometer and magnetometer it works perfectly fine and i sent the data from my microcontroler stm32 to labview with UART connection the data is good before i send it so i think there is a problem in reading data in labview if anyone can point out my mistake i would be thankful.
I attached PNG of my data charts where you can see sometimes the read is wrong and i get random peaks to -400000 for example
also here are my UART settings i used for microcontroller
huart2.Instance = USART2;
huart2.Init.BaudRate = 115200;
huart2.Init.WordLength = UART_WORDLENGTH_8B;
huart2.Init.StopBits = UART_STOPBITS_1;
huart2.Init.Parity = UART_PARITY_NONE;
huart2.Init.Mode = UART_MODE_TX_RX;
huart2.Init.HwFlowCtl = UART_HWCONTROL_NONE;
huart2.Init.OverSampling = UART_OVERSAMPLING_16;
huart2.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
huart2.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
01-04-2024 05:35 AM - edited 01-04-2024 06:13 AM
Hi Adweqweq,
@Adweqweq wrote:
if anyone can point out my mistake i would be thankful.
Using BytesAtPort is a big mistake!
Initializing the port in each iteration is a big mistake!
You just need to read 99 bytes from your port, VISARead will handle all the rest as it also recognizes the CR/LF chars in your messages…
Also your string parsing is way too complicated: why not use SpreadsheetStringToArray with a comma as separator?
01-04-2024 06:10 AM
Thank you for your insights i am knew to this and this was very helpful