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.

LAUNCHXL-F28379D: Issue with I2C Communication: F28379D as Slave

Part Number: LAUNCHXL-F28379D

Tool/software:

Hello everyone,

I'm experiencing some issues when using I2C with the F28379D as a slave device.

  1. I have set the I2C slave address of the F28379D to 0x50, but on the master side, the detected address is 0x00. If I try to force a write operation to 0x50, the transmission fails.
  2. When writing to address 0x00 from the master, there is a data delay issue on the F28379D slave side. For example:
    • The first transmitted value is 10, but the slave does not update.
    • The second transmitted value is 11, but the slave only updates to the first value (10).
    • The third transmitted value is 12, but the slave updates to 11, and so on.

I have tested the same setup with other slave devices, and these issues did not occur.

I would appreciate any help in troubleshooting this problem. Thank you!

For reference, I am using the example code i2c_ex5_master_slave_interrupt.c as my slave-side implementation. Here is the code:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <i2cLib_FIFO_master_slave_interrupt.h>
#include "device.h"
#include "driverlib.h"
#include "board.h"
#define I2CA_ADDRESS 0x30
#define I2CB_ADDRESS 0x50
//
// Globals
//
uint16_t status = 0;
uint16_t status_intoisr = 0;
uint16_t status_interrupt = 0;
uint16_t slave = 0;
uint16_t slavefifo = 0;
uint16_t rData_size = 0;
uint16_t fifoDepth = 0;
uint16_t tempData[MAX_BUFFER_SIZE];
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Hi, I'd appreciate a response soon. Let me know if you need any more information. Thanks

  • Hi TingHsuan,

    Apologies for the delay. Could you confirm if the C2000 target is only in receiver mode or also transmitter? You'll need the 'I2C_setOwnAddress' function to set the own address for the I2C target. It's is compared against the target address sent by an I2C controller. I believe that line 290 is unnecessary if I2CB is only acting as the target as per your above comments. The example configures I2CA and I2CB as controller because there are four combinations of I2C operations happening.

    In addition, if you are communicating with a temp sensor, you could also use any of the EEPROM examples as a basis instead too. 

    Best Regards,

    Aishwarya

  • Thank you for your response.

    1. I need to set the C2000 target to receiver mode.
    2. Thank you! Setting the own address using I2C_setOwnAddress fixed my first problem.
    3. When I followed your suggestion and disabled line 290, I also changed line 291 from "I2C_setConfig(I2CB_BASE, I2C_MASTER_SEND_MODE);" to "I2C_setConfig(I2CB_BASE, I2C_SLAVE_RECEIVE_MODE);"—but in this case, the I2C communication did not work. It only works when set to "I2C_MASTER_SEND_MODE" or "I2C_MASTER_RECEIVE_MODE", and my second issue still remains.

    Do you have any suggestions? Thanks!

  • Hi TingHsuan,

    Please expect a delayed response as Aishwarya is currently out of office for the next week. I apologize for any inconvenience.

    Best Regards,

    Delaney

  • Hi Delaney, Aishwarya

    My problem has been solved, thanks for your help!