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.

PGA302: Connect two PGA302(slave) using two MSP430FR5969 (master) with usb2anydll

Part Number: PGA302
Other Parts Discussed in Thread: MSP430FR5969

Tool/software:

Dear,

I'm trying to calibrate PGA302(slave) using MSP430FR5969 (master) launchpad through I2C protocol.

There are two PGA302s on my board. We want to read/write use two PGA302's registers using MSP430FR5969 (master) launchpad through I2C protocol in one program.

Is this possible?

Best regards.

Jimy

  • Hi Jimy, 

    Yes, it is possible to communicate to multiple PGA302 devices using 1 master over I2C. However, I would recommend using an I2C switch to avoid bus conflicts. 

    Thanks,

    Maggie

  • Hi Maggie,

    We use 2 masters to communicate to 2 PGA302 devices over I2C with usb2anydll. But the value of PGA302 registers read is unexpected.

    m_EE302_H0_A is 0x2000(is right) before the second u2aOpen and after the second u2aOpen and configures m_EE302_H0_A_2 is 0x213d(is wrong and actually is the value of m_EE302_H0_B).

    Anything wrong?

    The program outline is:

    int  usb_num = u2aFindControllers();  // returned 2

    char szSerialNumber_A;
    int num = u2aGetSerialNumber(0, szSerialNumber_A);    // returned num: 0, szSerialNumber_A: "39A4934608001C00"

    int u2a_handle_A = u2aOpen(szSerialNumber_A);    // returned 0x3010
    u2aSetReceiveTimeout(20);

    BYTE buffer_A[64];
    int read_A = u2aFirmwareVersion_Read(u2a_handle_A , (BYTE *)buffer_A, sizeof(buffer_A));  // returned read_A :4, buffer_A: 0x02,0x07,0x00,0x034

    Configure_GPIOs_of_A();

    u2aSPI_Control(u2a_handle_A , SPI_Change_On_Following_Edge, SPI_Inactive_State_Low, SPI_MSB_First, SPI__8_Bit, SPI_With_Every_Word, SPI_High_To_Low, 0, 8);
    u2aI2C_Control(u2a_handle_A , I2C_400kHz, I2C_7Bits, I2C_PullUps_OFF);
    u2aADC_Control(u2a_handle_A , ADC_Analog_In, ADC_Analog_In, ADC_Analog_In, ADC_Analog_In, ADC_VREF_3V3);

    m_revision_A = comm_low_level_read_single(u2a_handle_A , 0, 0);    // returned m_revision_A :0
    m_dev_state_A = comm_low_level_read_single(u2a_handle_A , 0, 12);    // returned m_dev_state_A :3

    m_EE302_H0_A = (comm_low_level_read_single(u2a_handle_A , 5, 1) << 8) + comm_low_level_read_single(u2a_handle_A , 5, 0);// returned m_EE302_H0_A: 0x2000


    char szSerialNumber_B;
    int num = u2aGetSerialNumber(1, szSerialNumber_B);    // returned num: 0, szSerialNumber_B: "39A4934629003100"

    int u2a_handle_B = u2aOpen(szSerialNumber_B);    // returned 0x3011
    u2aSetReceiveTimeout(20);

    BYTE buffer_B[64];
    int read_B = u2aFirmwareVersion_Read(u2a_handle_B , (BYTE *)buffer_B, sizeof(buffer_B));  // returned read_B :4, buffer_B: 0x02,0x07,0x00,0x034

    Configure_GPIOs_of_B();

    u2aSPI_Control(u2a_handle_B , SPI_Change_On_Following_Edge, SPI_Inactive_State_Low, SPI_MSB_First, SPI__8_Bit, SPI_With_Every_Word, SPI_High_To_Low, 0, 8);
    u2aI2C_Control(u2a_handle_B, I2C_400kHz, I2C_7Bits, I2C_PullUps_OFF);
    u2aADC_Control(u2a_handle_B , ADC_Analog_In, ADC_Analog_In, ADC_Analog_In, ADC_Analog_In, ADC_VREF_3V3);

    m_revision_B = comm_low_level_read_single(u2a_handle_B , 0, 0);    // returned m_revision_B :0
    m_dev_state_B = comm_low_level_read_single(u2a_handle_B , 0, 12);    // returned m_dev_state_B:3

    m_EE302_H0_A_2 = (comm_low_level_read_single(u2a_handle_A , 5, 1) << 8) + comm_low_level_read_single(u2a_handle_A , 5, 0);// returned m_EE302_H0_A_2: 0x213d

    m_EE302_H0_B = (comm_low_level_read_single(u2a_handle_B , 5, 1) << 8) + comm_low_level_read_single(u2a_handle_B , 5, 0);// returned m_EE302_H0_B: 0x213d

    Best regards,

    Jimy

  • Hi Jimy, 

    Let's start with your hardware. Can you please provide a schematic? Are you using two masters or one master? How are they connected to your PGA302 devices? Can you provide oscilloscope shots of your I2C communications?

    What are the registers do you intend to read? What peripheral and register addresses are you using?

    Thanks,

    Maggie

  • Hi Maggie,

    We use 2 PGA302EVM-037 evaluation boards in our test case. The program is the PGA302EVM-GUI and we add a second u2aOpen, configure_of_gpios and coresponding u2aI2C_RegisterRead.

    m_EE302_H0_A = (u2aI2C_RegisterRead(u2a_handle_A, (UInt16)(0x40 + 5), 1) << 8)+u2aI2C_RegisterRead(u2a_handle_A, (UInt16)(0x40 + 5), 0);

    m_EE302_H0_B = (u2aI2C_RegisterRead(u2a_handle_B, (UInt16)(0x40 + 5), 1) << 8)+u2aI2C_RegisterRead(u2a_handle_B, (UInt16)(0x40 + 5), 0);

    Best regards,

    Jimy

  • Hi Jimy, 

    So both PGA302 evaluation boards are directly connected to the MSP430?

    It looks like you're trying to read the H0_MSB and H0_LSB, is that correct? Just to make sure I understand, you have two PGA devices you want to communicate with, PGA302-A and PGA302-B. When you read H0_MSB+H0_LSB from PGA302-A, you get the correct value, but after you initialize PGA302-B, when you try to read H0_MSB+H0_LSB from PGA302-A again, you get the H0_MSB+H0_LSB value from PGA302-B, is this correct?

    If you can provide oscilloscope or logic analyzer shots of the I2C communications that would be helpful.

  • Hi Maggie,

    We are researching another way to the calibration.

    Thanks a lot.

    Jimy