2024-12-17 03:58 AM - edited 2024-12-17 04:06 AM
Hi all
I have a TESEO LIV4F connected to an STMF411CEU6 via I2C. I am able to read the NMEA sentences ($GNRMC etc.) at 1Hz via I2C.
I would like to set the fix rate to the maximum 10Hz as outlined in the datasheet, but i am not able to do so. In fact I am unable to get a response for any of the commands I send via I2C. I only receive the NMEA data like $GNRMC
I've read through the documentation for the LIV4F, the software manual (UM3009) says that for the firmware configuration: "The "Factory Setting" can be changed and saved at run-time using specific NMEA commands" and also gives some I2C commands, so I am led to believe this is possible.
Has anyone been able to configure the fix rate via I2C commands in run-time?
Here is a code snippet I am using to test my board:
//Command message to send
//I have also tried $PSTMGETPAR,1231 and $PSTMSETPAR,1190,0.1 with and without the "\n\r" and received no responses.
static const char *cmd = "$PSTMGETPAR,1190\n\r";
HAL_I2C_Master_Transmit(&hi2c1, 0x3a<<1, (uint8_t *)cmd, strlen(cmd), HAL_MAX_DELAY);
// Wait for the response
HAL_Delay(100);
// Read the response (parameters or status)
uint8_t response[256];
HAL_I2C_Master_Receive(&hi2c1, 0x3a<<1, response, sizeof(response), HAL_MAX_DELAY);
//this is only receiving NMEA sentences like &GNRMC, not the proprietary STM command responses like //$PSTMGETPARERROR or $PSTMSETPAR
printf("response : %s\n", response);
HAL_Delay(1000);
thanks
Tom Anderson
2024-12-17 06:52 PM
> //I have also tried $PSTMGETPAR,1231 and $PSTMSETPAR,1190,0.1 with and without the "\n\r" and received no responses.
> static const char *cmd = "$PSTMGETPAR,1190\n\r";
What about the * and the checksum?
2024-12-17 08:10 PM - edited 2024-12-17 08:11 PM
Hi TDK,
I have since tried to implement the checksum with this function (and verified with an online NMEA checksum calculator https://www.meme.au/nmea-checksum.html)
void TA_send_NMEA_command(uint8_t *command)
{
//perform the checksum calc
uint8_t checksum = 0;
for (int i = 0; i < strlen(command); i++)
{
checksum ^= command[i];
}
//Append the $, *, checksum, \n, \r to the command
uint8_t TxBuffer[100] = {0};
uint8_t index = 0;
TxBuffer[index++] = '$'; //start with $
for(int i=0; i<strlen(command); i++) //add the whole command str
{
TxBuffer[index++] = command[i];
}
TxBuffer[index++] = '*'; //add *
sprintf(&TxBuffer[index++], "%02X", checksum); // add checksum
index++;
TxBuffer[index++] = '\r'; //add \n\r
TxBuffer[index++] = '\n';
HAL_I2C_Master_Transmit(&hi2c1, (0x3a<<1) , TxBuffer, strlen(TxBuffer), HAL_MAX_DELAY);
}
With this I have sent "$PSTMGETPAR,1190*2A\r\n", "$PSTMSETPAR,1190,0.1*3D\r\n", "$PSTMGETPAR,1231*22\r\n", still with no luck.