This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

BOOSTXL-PGA460: Doubt regarding UART interface between master controller and PGA460

Part Number: BOOSTXL-PGA460
Other Parts Discussed in Thread: PGA460, ENERGIA

Hi,

I am using a different controller as master for PGA460.(UART is initialized with 115200 baudrate, 2 stop bit, 8 data bit, UART_DIAG = 1) 

From PGA460EnergiaLibrary_v1.0.2 i got .cpp and .h driver files, i converted .cpp driver to .c driver. I am able to write threshold, read threshold, write to eeprom, read from eeprom, write shadow register, read from shadow register but when i am using system diagnostics PGA460 will reply with 40 00 00 00 after this reply when ever i am trying to do any operation(read shadow reg ) its replying with 00 00 00 00. In case of pull echo data dump PGA460 will reply with 4C 00 00, after that no reading or writing commands are processed. 

following are the fuctions called

initBoostXLPGA460(0,115200,0);


initThresholds(3);   //3 - customized threshold value

readThresholds();


defaultPGA460(2);   //2 - customized default value

burnEEPROM();

initTVG(3, 3);      //3 - customized TVG value


read_shadow_register();

runEchoDataDump(0);             //ultrasonicCmd(1, 1);

                                                 //ultrasonicCmd(0, 1); 

                                                 //runDiagnostics(1,0);
pullEchoDataDump(0);

read_shadow_register();

for ultrasonicCmd(0, 1);  UART data transmitted are ; 55 00 01 FE

for ultrasonicCmd(1, 1);  UART data transmitted are ; 55 01 01 FD

for runDiagnostics(1, 0);  UART data transmitted are ; 55 08 F7       reply is 40 00 00 00 after this command, no other commands are working correctly(read and write commands).

In GUI interface mode i am able to get valid reply from PGA460 for all the commands.

Can you help me with this situation

Thanks and Regards,

  • Hi Neville,

    Thank you for posting your question! Our PGA460 expert, Akeem, will be able to address your question when he's back in the office on Monday.

    Best regards,
    Blair
  • Hi Neville,

    To help debug this matter, run the following experiments:
    • Try adding some additional delay (1s) between the runDiagnostics command, and the previous command. Perhaps there is conflict with a previous command still processing data, and forces a failure due to the interrupt.
    • Start the program by running the runDiagnostic command before anything else to determine if the function itself is defective, or there is a dependency on a previous command executing. Set the second command to read any register value to determine if any non-zero return data is provided.

    I am not able to replicate this failure when using the MSP430 in Energia. Since you've ported and reformatted the library code, I am not entirely certain why this function would be failing on your master controller without having complete visibility to your custom master library code. Can you share your version of the runDiagnostic function?
  • Hi Akeem,

    I have given delay between the runDiagnostics command, and the previous command but still same problem persist.

    Started the program by running the runDiagnostic command, after the execution of run diagnostic command read command reply was zero values.

    runDiagnostics function is as follows:

    double runDiagnostics(uint8_t run, uint8_t diag)
    {
    double diagReturn = 0;

    if (run == 1) //run system diagnostics command
    {

    uint8_t buf8[3] = {syncbyte, SD, calcChecksum(SD)};
    PGA460_Write(buf8, sizeof(buf8), 1000);
    HAL_Delay(100); // tried giving 1s delay here

    PGA460_Read(diagMeasResult, 4, MAX_MILLIS_TO_WAIT);
    Print(diagMeasResult, sizeof(diagMeasResult), 1000);
    }

    if (diag == 2) //run temp level meas
    {
    tempOrNoise = 0; // temp meas
    uint8_t buf4[4] = {syncbyte, TNLM, tempOrNoise, calcChecksum(TNLM)};
    PGA460_Write(buf4, sizeof(buf4), 1000);

    HAL_Delay(100);

    uint8_t buf6[3] = {syncbyte, TNLR, calcChecksum(TNLR)}; // temp and noise meas results
    PGA460_Write(buf6, sizeof(buf6), 1000);

    HAL_Delay(100);
    }

    if (diag == 3) // run noise level meas
    {
    tempOrNoise = 1; // noise meas
    uint8_t buf4[4] = {syncbyte, TNLM, tempOrNoise, calcChecksum(TNLM)}; // noise meas
    PGA460_Write(buf4, sizeof(buf4), 1000);

    HAL_Delay(100);

    uint8_t buf6[3] = {syncbyte, TNLR, calcChecksum(TNLR)}; // temp and noise meas results
    PGA460_Write(buf6, sizeof(buf6), 1000);

    HAL_Delay(100);
    }

    if (diag == 2 || diag == 3) // pull temp and noise level results
    {
    PGA460_Read(tempNoiseMeasResult, 4, MAX_MILLIS_TO_WAIT);
    }

    HAL_Delay(100);

    switch (diag)
    {
    case 0: // transducer frequency
    {
    diagReturn = (1 / (diagMeasResult[1] * 0.0000005)) / 1000;
    }
    break;
    case 1: // decay period time (us)
    {
    diagReturn = diagMeasResult[2] * 16;
    }
    break;
    case 2: //temperature
    {
    diagReturn = ((tempNoiseMeasResult[1] - 0) / (1 + (0 / 128)) - 64) / 1.5;
    }
    break;
    case 3: //noise
    {
    diagReturn = tempNoiseMeasResult[2];
    }
    break;
    default: break;
    }

    return diagReturn;
    }



    PGA460_Write and PGA460_Read are UART0 polling read and write .
    Print is UART1 debug print

    Thanks and Regards,