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.

PGA460-Q1: PGA460 response 0x05 Ultrasonic measurement result with Diagnostic Data Error status [4] Invalid command sent from master

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

Hi,

I am trying to read Ultrasonic measurement result between a MCU board ( Infineon XC2267M) to BOOSTXL-PGA460 (PGA460-Q1 Ultrasonic Sensor Signal Conditioning EVM With Transducers).

0x0B UART EEPROM bulk read executed OK

but 0x05 Ultrasonic measurement result get response ---Invalid command sent from master

===========try sample data as PGA460 datasheet in page 55 (with master generated checksum)=================
Example4 – Execute command 5 (ultrasonic measurement result), where PGA460-Q1 address is 0x0,
Master to PGA460-Q1: 0x55, 0x05, 0xFA …


======================try sample data without master generated checksum======================

see scope screen below

for 0x05 Ultrasonic measurement result , both request get Diagnostic Data Error status [4] Invalid command sent from master

can anyone help to check what was missed?

Thanks,

Aaron

  • the decoding in last post is wrong, 

    for 0x05 Ultrasonic measurement result , both frame has decoding 00010010B for Diagnostic Data field. which means

    Error status [3] Invalid checksum received from master (essentially a calculated slave checksum does not match the checksum transmitted by the master)

    then the question becomes why PGA460 response Diagnostic Data field with checksum error while MCU is still transmitting master checksum?

  • Hi Aaron,

    Let us look into this and get back to you.

    Meanwhile if you haven't had a chance to look at the FAQ please do so.

    e2e.ti.com/.../748143

  • Hi Aaron,

    In your use-case, are you executing the following commands to read back the ultrasonic measurement results properly?:

    1. Write to the thresholds registers to clear the THR_CRC_ERR. This can be done as a bulk threshold write (command 16) or individual register write.
    2. Send a burst/listen command (command 0-3) while DATADUMP_EN=0 (start-up default)
    3. Wait for the burst/listen command to finish execution based on the present record length time (between 5-66ms). I recommend you wait 100ms for debug.
    4. Then send the ultrasonic measurement results command (command 5)

    The master generated checksum is not required for command 5, or any other slave response command other than single register read.

    What command do you send prior to command 5? Note, if a particular diagnostic field bit is set to 1 then the associated communication error has occurred sometime between the last response operation and the current response operation. This means the error is being reported for the command sent previous to command 5. What happens when you send command 5 two times in a row? Does the last response still report an erroneous diagnostic field?

  • Hi Akeem,

    Thank you for your support even in the weekend.

    here is my UART command send after the power up

    11, EEPROM bulk read
    12, EEPROM bulk write
    16, Threshold bulk write
    0, Burst and listen (Preset1)
    5, Ultrasonic measurement result

    I believed you already pointed out the checksum error report on frame 0x05 is from previous frame 0x00.

    for command 0x00, I used the data and checksum from PGA460 datasheet as below.

    Master to PGA460-Q1: 0x55, 0x00, 0x01, 0xFE

    my current writeframe checksum function doesn't work well, would you please check whether 0xFE is correct checksum for  above command 0x00? 

    it would be appreciated if you can provide a C writeframe checksum function for PGA460

    here is the writeframe checksum function currently used.

    void UART_vUpdWtFrmCheckSum(E_PGACMDID eFrmCmd)
    {
    unsigned char u8FrmLen;
    unsigned int u16aChecksumInput[DEF_UARTBUFMAX];
    int checksumLoops = 0;
    eFrmCmd = eFrmCmd & 0x001F; // zero-mask command address of eFrmCmd to select correct switchcase statement

    switch(eFrmCmd)
    {
    case Ce_CmdP1BL: // 0, Burst and listen (Preset1) ;
    u8FrmLen = LEN(P1BL);
    break;

    case Ce_CmdP2BL: // 1, Burst and listen (Preset2) ;
    u8FrmLen = LEN(P2BL);
    break;

    case Ce_CmdP1LO: // 2, Listen only (Preset1) ;
    u8FrmLen = LEN(P1LO);
    break;

    case Ce_CmdP2LO: // 3, Listen only (Preset2) ;
    u8FrmLen = LEN(P2LO);
    break;

    case Ce_CmdTNLM: // 4, Temperature and noise-level measurement ;
    u8FrmLen = LEN(TNLM);
    break;

    case Ce_CmdUMR : // 5, Ultrasonic measurement result ;
    u8FrmLen = LEN(UMR);
    break;

    case Ce_CmdTNLR: // 6, Temperature and noise level result ;
    u8FrmLen = LEN(TNLR);
    break;

    case Ce_CmdTEDD: // 7, Transducer echo data dump ;
    u8FrmLen = LEN(TEDD);
    break;

    case Ce_CmdSD : // 8, System diagnostics ;
    u8FrmLen = LEN(SD);
    break;

    case Ce_CmdSRR : // 9, Register read ;
    u8FrmLen = LEN(SRR);
    break;

    case Ce_CmdSRW : // 10, Register write ;
    u8FrmLen = LEN(SRW);
    break;

    case Ce_CmdEEBR: // 11, EEPROM bulk read ;
    u8FrmLen = LEN(EEBR);
    break;

    case Ce_CmdEEBW: // 12, EEPROM bulk write ;
    u8FrmLen = LEN(EEBW);
    break;

    case Ce_CmdTVGBR: // 13, Time-varying-gain bulk read ;
    u8FrmLen = LEN(TVGBR);
    break;

    case Ce_CmdTVGBW: // 14, Time-varying-gain bulk write ;
    u8FrmLen = LEN(TVGBW);
    break;

    case Ce_CmdTHRBR: // 15, Threshold bulk read ;
    u8FrmLen = LEN(THRBR);
    break;

    case Ce_CmdTHRBW: // 16, Threshold bulk write ;
    u8FrmLen = LEN(THRBW);
    break;

    //the following are BROADCAST
    case Ce_CmdBC_P1BL: // 17, 0x11, Burst and listen (Preset1) ;
    case Ce_CmdBC_P2BL: // 18, 0x12 Burst and listen (Preset2) ;
    case Ce_CmdBC_P1LO: // 19, 0x13 Listen only (Preset1) ;
    case Ce_CmdBC_P2LO: // 20, 0x14 Listen only (Preset2) ;
    case Ce_CmdBC_TNLM: // 21, 0x15 Temperature and noise-level measurement ;
    case Ce_CmdBC_RW: // 22, 0x16 Register write ;
    case Ce_CmdBC_EEBW: // 23, 0x17 EEPROM bulk write ;
    case Ce_CmdBC_TVGBW: // 24, 0x18 Time-varying-gain bulk write ;
    case Ce_CmdBC_THRBW: // 25, 0x19 Threshold bulk write ;
    default:
    return;//not implemented
    }

    checksumLoops = u8FrmLen -1;

    switch(eFrmCmd)
    {
    case Ce_CmdP1BL: // 0, Burst and listen (Preset1) ;
    memcpy(&u16aChecksumInput[0], &Ps_PGAF60.u16a_FrmP1BL[0],checksumLoops * sizeof(unsigned int));
    break;

    case Ce_CmdP2BL: // 1, Burst and listen (Preset2) ;
    memcpy(&u16aChecksumInput[0], &Ps_PGAF60.u16a_FrmP2BL[0],checksumLoops * sizeof(unsigned int));
    break;

    case Ce_CmdP1LO: // 2, Listen only (Preset1) ;
    memcpy(&u16aChecksumInput[0], &Ps_PGAF60.u16a_FrmP1LO[0],checksumLoops * sizeof(unsigned int));
    break;

    case Ce_CmdP2LO: // 3, Listen only (Preset2) ;
    memcpy(&u16aChecksumInput[0], &Ps_PGAF60.u16a_FrmP2LO[0],checksumLoops * sizeof(unsigned int));
    break;

    case Ce_CmdTNLM: // 4, Temperature and noise-level measurement ;
    memcpy(&u16aChecksumInput[0], &Ps_PGAF60.u16a_FrmTNLM[0],checksumLoops * sizeof(unsigned int));
    break;

    case Ce_CmdUMR : // 5, Ultrasonic measurement result ;
    memcpy(&u16aChecksumInput[0], &Ps_PGAF60.u16a_FrmUMR[0],checksumLoops * sizeof(unsigned int));
    break;

    case Ce_CmdTNLR: // 6, Temperature and noise level result ;
    memcpy(&u16aChecksumInput[0], &Ps_PGAF60.u16a_FrmTNLR[0],checksumLoops * sizeof(unsigned int));
    break;

    case Ce_CmdTEDD: // 7, Transducer echo data dump ;
    memcpy(&u16aChecksumInput[0], &Ps_PGAF60.u16a_FrmTEDD[0],checksumLoops * sizeof(unsigned int));
    break;

    case Ce_CmdSD : // 8, System diagnostics ;
    memcpy(&u16aChecksumInput[0], &Ps_PGAF60.u16a_FrmSD[0],checksumLoops * sizeof(unsigned int));
    break;

    case Ce_CmdSRR : // 9, Register read ;
    memcpy(&u16aChecksumInput[0], &Ps_PGAF60.u16a_FrmSRR[0],checksumLoops * sizeof(unsigned int));
    break;

    case Ce_CmdSRW : // 10, Register write ;
    memcpy(&u16aChecksumInput[0], &Ps_PGAF60.u16a_FrmSRW[0],checksumLoops * sizeof(unsigned int));
    break;

    case Ce_CmdEEBR: // 11, EEPROM bulk read ;
    memcpy(&u16aChecksumInput[0], &Ps_PGAF60.u16a_FrmEEBR[0],checksumLoops * sizeof(unsigned int));
    break;

    case Ce_CmdEEBW: // 12, EEPROM bulk write ;
    memcpy(&u16aChecksumInput[0], &Ps_PGAF60.u16a_FrmEEBW[0],checksumLoops * sizeof(unsigned int));
    break;

    case Ce_CmdTVGBR: // 13, Time-varying-gain bulk read ;
    memcpy(&u16aChecksumInput[0], &Ps_PGAF60.u16a_FrmTVGBR[0],checksumLoops * sizeof(unsigned int));
    break;

    case Ce_CmdTVGBW: // 14, Time-varying-gain bulk write ;
    memcpy(&u16aChecksumInput[0], &Ps_PGAF60.u16a_FrmTVGBW[0],checksumLoops * sizeof(unsigned int));
    break;

    case Ce_CmdTHRBR: // 15, Threshold bulk read ;
    memcpy(&u16aChecksumInput[0], &Ps_PGAF60.u16a_FrmTHRBR[0],checksumLoops * sizeof(unsigned int));
    break;

    case Ce_CmdTHRBW: // 16, Threshold bulk write ;
    memcpy(&u16aChecksumInput[0], &Ps_PGAF60.u16a_FrmTHRBW[0],checksumLoops * sizeof(unsigned int));
    break;

    //the following are BROADCAST
    case Ce_CmdBC_P1BL: // 17, 0x11, Burst and listen (Preset1) ;
    case Ce_CmdBC_P2BL: // 18, 0x12 Burst and listen (Preset2) ;
    case Ce_CmdBC_P1LO: // 19, 0x13 Listen only (Preset1) ;
    case Ce_CmdBC_P2LO: // 20, 0x14 Listen only (Preset2) ;
    case Ce_CmdBC_TNLM: // 21, 0x15 Temperature and noise-level measurement ;
    case Ce_CmdBC_RW: // 22, 0x16 Register write ;
    case Ce_CmdBC_EEBW: // 23, 0x17 EEPROM bulk write ;
    case Ce_CmdBC_TVGBW: // 24, 0x18 Time-varying-gain bulk write ;
    case Ce_CmdBC_THRBW: // 25, 0x19 Threshold bulk write ;
    default:
    break;
    }

    if (u16aChecksumInput[0] < 17) //only re-append command address for non-broadcast commands.
    {
    u16aChecksumInput[0] = u16aChecksumInput[0] + (Ps_PGAF60.u8UartAddr << 5);//PGA460 Software Development Guide
    }

    unsigned int u16Carry = 0;
    for (int i = 0; i < checksumLoops; i++)
    {
    if ((u16aChecksumInput[i] + u16Carry) < u16Carry)
    {
    u16Carry = u16Carry + u16aChecksumInput[i] + 1;
    }
    else
    {
    u16Carry = u16Carry + u16aChecksumInput[i];
    }
    if (u16Carry > 0xFF)
    {
    u16Carry = u16Carry - 255;
    }
    }

    u16Carry = (~u16Carry & 0x00FF);

    switch(eFrmCmd)
    {
    case Ce_CmdP1BL: // 0, Burst and listen (Preset1) ;
    Ps_PGAF60.u16a_FrmP1BL[ LEN(P1BL) - 1U] = u16Carry;
    break;

    case Ce_CmdP2BL: // 1, Burst and listen (Preset2) ;
    Ps_PGAF60.u16a_FrmP2BL[ LEN(P2BL) - 1U] = u16Carry;
    break;

    case Ce_CmdP1LO: // 2, Listen only (Preset1) ;
    Ps_PGAF60.u16a_FrmP1LO[ LEN(P1LO) - 1U] = u16Carry;
    break;

    case Ce_CmdP2LO: // 3, Listen only (Preset2) ;
    Ps_PGAF60.u16a_FrmP2LO[ LEN(P2LO) - 1U] = u16Carry;
    break;

    case Ce_CmdTNLM: // 4, Temperature and noise-level measurement ;
    Ps_PGAF60.u16a_FrmTNLM[ LEN(TNLM) - 1U] = u16Carry;
    break;

    case Ce_CmdUMR : // 5, Ultrasonic measurement result ;
    Ps_PGAF60.u16a_FrmUMR[ LEN(UMR) - 1U] = u16Carry;
    break;

    case Ce_CmdTNLR: // 6, Temperature and noise level result ;
    Ps_PGAF60.u16a_FrmTNLR[ LEN(TNLR) - 1U] = u16Carry;
    break;

    case Ce_CmdTEDD: // 7, Transducer echo data dump ;
    Ps_PGAF60.u16a_FrmTEDD[ LEN(TEDD) - 1U] = u16Carry;
    break;

    case Ce_CmdSD : // 8, System diagnostics ;
    Ps_PGAF60.u16a_FrmSD[ LEN(SD) - 1U] = u16Carry;
    break;

    case Ce_CmdSRR : // 9, Register read ;
    Ps_PGAF60.u16a_FrmSRR[ LEN(SRR) - 1U] = u16Carry;
    break;

    case Ce_CmdSRW : // 10, Register write ;
    Ps_PGAF60.u16a_FrmSRW[ LEN(SRW) - 1U] = u16Carry;
    break;

    case Ce_CmdEEBR: // 11, EEPROM bulk read ;
    Ps_PGAF60.u16a_FrmEEBR[ LEN(EEBR) - 1U] = u16Carry;
    break;

    case Ce_CmdEEBW: // 12, EEPROM bulk write ;
    Ps_PGAF60.u16a_FrmEEBW[ LEN(EEBW) - 1U] = u16Carry;
    break;

    case Ce_CmdTVGBR: // 13, Time-varying-gain bulk read ;
    Ps_PGAF60.u16a_FrmTVGBR[ LEN(TVGBR) - 1U] = u16Carry;
    break;

    case Ce_CmdTVGBW: // 14, Time-varying-gain bulk write ;
    Ps_PGAF60.u16a_FrmTVGBW[ LEN(TVGBW) - 1U] = u16Carry;
    break;

    case Ce_CmdTHRBR: // 15, Threshold bulk read ;
    Ps_PGAF60.u16a_FrmTHRBR[ LEN(THRBR) - 1U] = u16Carry;
    break;

    case Ce_CmdTHRBW: // 16, Threshold bulk write ;
    Ps_PGAF60.u16a_FrmTHRBW[ LEN(THRBW) - 1U] = u16Carry;
    break;

    //the following are BROADCAST
    case Ce_CmdBC_P1BL: // 17, 0x11, Burst and listen (Preset1) ;
    case Ce_CmdBC_P2BL: // 18, 0x12 Burst and listen (Preset2) ;
    case Ce_CmdBC_P1LO: // 19, 0x13 Listen only (Preset1) ;
    case Ce_CmdBC_P2LO: // 20, 0x14 Listen only (Preset2) ;
    case Ce_CmdBC_TNLM: // 21, 0x15 Temperature and noise-level measurement ;
    case Ce_CmdBC_RW: // 22, 0x16 Register write ;
    case Ce_CmdBC_EEBW: // 23, 0x17 EEPROM bulk write ;
    case Ce_CmdBC_TVGBW: // 24, 0x18 Time-varying-gain bulk write ;
    case Ce_CmdBC_THRBW: // 25, 0x19 Threshold bulk write ;
    default:
    break;
    }
    }

  • 0x05 get response after correct master check sum

    Thanks,