Skip to main content
Associate
December 17, 2024
Question

TESO LIV4F - set fix rate via I2C commands

  • December 17, 2024
  • 1 reply
  • 1171 views

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

1 reply

TDK
Super User
December 18, 2024

> //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?

TDK_0-1734490220677.png

 

TDK_1-1734490322203.png

 

"If you feel a post has answered your question, please click ""Accept as Solution""."
Associate
December 18, 2024

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.

 

Technical Moderator
December 24, 2024

Hi Tom,

To update the GNSS fix rate, the CDB register that needs to be updated is CDB-303. The command you would need to send would be the the commands shown below

$PSTMSETPAR,1303,0.1 //sets update rate to 10Hz
$PSTMSAVEPAR //saves the values
$PSTMSRR //software reset device for value to take effect

//to read value back after reset
$PSTMGETPAR,1303

 

To send data to LIV4F module, you can use the API as shown below in app_gnss.c

uint8_t get_update_rate[] = "$PSTMGETPAR,1303";				
GNSS_DATA_SendCommand(&get_update_rate[0]);						

In our firmware, we do not have the code to read the response for $PSTMGETPAR. Therefore, you would need to manually add the code.

These are the changes that you would need to do,

  • NMEA_parser.h - add function declaration to read response of PSTMGETPAR
  • NMEA_parser.c - add function definition to the declaration above. (you can follow the same method as other parser functions)
  • GNSS_parser.h - modify eNMEAMsg to add the enum that should be parsed. NMEA_MSGS_NUM value to reflect the enums added

If you have a logic analyzer, could you please capture the screenshot of I2C bus when you send the data? I would like to see if the device is ACKing the data sent to it.

Thanks,

George

​In order 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.