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.

PGA450-Q1: LIN request nor working with multiple devices

Part Number: PGA450-Q1

Hi,

I have multiple pga450 devices on a lin bus. I have implemented an addressing scheme together with basic commands by using the PID  (upper 3 bits for command, lower 3 bits for address). I can communicate with the devices fine using their assigned addresses. but my problem is the first time when I tell a device to do a measurement and then ask if for the time of flight data back, I just receive 0xFF 0xFF from the time of flight variable. 

this is because the condition in code:[ if ( echo_data > DetectionThreshold) ]  is never met. But at the second reading it is, and then afterwards every signel time I do a reading I get valid data.  Then when I take a reading on another device, I again need to do 2 readings to get a valid response, and going back to the previous device, 2 readings needed again. this is not an interference issue between devices, I can wait seconds or minutes in between readings it does not matter. I am also sure that the RX interrupt of the wrong devices are not triggered, but still there are some interference when communicating with another device.

any ideas?

  • Hi Gideon,
    Is it possible to verify that the PGA450-Q1 is actually bursting when you send the two initial measurement commands? You can probe the transducer with an oscilloscope to monitor excitation voltage. If excitation is true, can you then independently verify that the FIFO memory actually recorded the time-of-flight data? You may need to use the EVM, or write a UART routine to read the FIFO memory segment independently from the LIN interface.

    In addition, can you monitor to the LIN line using an oscilloscope to ensure the communication signal is maintaining integrity?

    I'm sorry if you've already tried some of this hardware debugging, but I want to ensure that this is strictly a LIN software related issue through process-of-elimination. I may need to see your code to help troubleshoot this further. I have not encountered this issue before.
  • Hi, thank you Akeem!

    The LIN bus comms is fine. I use the LIN example project version 2.1.1. my changes are only addressing at this stage. In the PID interrupt I used the upper 3 bits of the PID as commands and the lower 3 bits as an address.

    void linPID_ISR (void) interrupt 5 using 3{
    pid = LIN_PID&0x38;
    address = LIN_PID&0x7;
    if (address == data_EEPROM[31]){
    switch (pid){
    case 0x20: // Start Distance Measurement (1 -> long (0.5 to 5 meters, else short (< 1meter))
    DATA_CNT = 1; // Number of bytes to be received
    LIN_CTRL = 0; // Rx
    EI6 = 1; // Enable LIN Rx Interrupt
    break;

    case 0x8:
    DATA_CNT = 3; // Number of bytes to be transmitted
    TX_DATA0 = 0x12;
    TX_DATA1 = 0x34;
    TX_DATA2 = data_EEPROM[31];
    LIN_CTRL = 1; // Tx
    EI7 = 1; // Enable Tx Interrupt
    break;

    case 0x10: // Transmit 2 bytes to Master (Echo)
    DATA_CNT = 2; // Number of bytes to be transmitted
    TX_DATA0 = TimeOfFlight.u8[0];
    TX_DATA1 = TimeOfFlight.u8[1];
    LIN_CTRL = 1; // Tx
    EI7 = 1; // Enable Tx Interrupt
    break;

    case 0x18: // Write first 7 bytes of EEPROM for echo thresholds
    DATA_CNT = 7; // LIN message will have 7 bytes
    LIN_CTRL = 0; // Setup for LIN receive
    EI6 = 1; // Enable LIN Rx Interrupt
    break;

    default: // Un-Defined LIN Command
    break;
    }
    }
    }

    On further inspection, your request for a check for excitation did show me something more. If I just use one device and I take a short measurement it works. if I then try a long distance measurement the first time will send bursts as if it is a short measurement again, and then after the second time I do a reading it is fine. if I switch back to short distance, it measures one long first and only then short for readings afterwards. So this seems to be the same problem as when I switch back and forth between 2 devices. It always does short distance burst on the first try, and then I do not get a threshold crossing on that, so therefore the bit of code in the receive interrupt is hit:

    if (MaskEcho == 0) {
    TimeOfFlight.u16 = 65535;
    }