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.

CC430F6137: I2C communication problem with NodeMCU

Part Number: CC430F6137

I'm trying to communicate CC430 microcontroller based board with ESP8266(NodeMCU). I can communicate in one-direction e.g. NodeMCU to CC430. However I can't send any character CC430 to NodeMCU board. What could be the problem? Connections are done properly e.g. Vcc--> Vcc , GND --> GND , SDA --> SDA , SCL --> SCL . There are also pull - up resistors. I tried the Arduino to NodeMCU communication , there is no problem with that. However neither Arduino nor NodeMCU can't get any character from CC430 side.

Code is given with link : https://dev.ti.com/tirex/explore/node?node=ALKC78J64Cwe6EXqBJh1DQ__IOGqZri__LATEST

  • When I try to debug with printf() function on that part ;

    if (TXByteCtr) // Check TX byte counter
    {
    UCB0TXBUF = TXData; // Load TX buffer
    TXByteCtr--; // Decrement TX byte counter
    printf("data wrote");
    }

    I can't get any response in that part. I assume that ISR can't triggering. How can I trigger the ISR?

  • Is the NodeMCU the master or the slave? It seems as though it can be either, depending on what code you run in the ESP8266.

    The MSP430 example you cited is (only) a Master Transmitter. Example cc430x613x_uscib0_i2c_07.c is a Slave Receiver.

    https://dev.ti.com/tirex/explore/node?node=ADTdTxz6cGK5P0cNLGjtfA__IOGqZri__LATEST

  • CC430 is using as master sender , NodeMCU is using as slave receiver. I used both master trasmitter and slave trasmitter , already there is no any response.

  • What code are you running on the NodeMCU? In particular, what I2C address is it using?

    Example i2c_06.c expects the (7-bit) address to be 0x48. It also doesn't check for NACK, so you might not be able to tell if the address is incorrect. (Try setting a breakpoint at the switch() in the ISR.)

  • #include <Wire.h>
    
    #define SDA_PIN 4
    #define SCL_PIN 5
    
    const int16_t I2C_MASTER = 0x42;
    const int16_t I2C_SLAVE = 0x48;
    
    void setup() {
      Serial.begin(115200);           // start serial for output
    
      Wire.begin(SDA_PIN, SCL_PIN, I2C_SLAVE); // new syntax: join i2c bus (address required for slave)
      Wire.onReceive(receiveEvent); // register event
    }
    
    void loop() {
    }
    
    // function that executes whenever data is received from master
    // this function is registered as an event, see setup()
    void receiveEvent(size_t howMany) {
    
      (void) howMany;
      while (1 < Wire.available()) { // loop through all but the last
        char c = Wire.read(); // receive byte as a character
        Serial.print(c);         // print the character
      }
      int x = Wire.read();    // receive byte as an integer
      Serial.println(x);         // print the integer
    }

    That's my NodeMCU code which is example code of the NodeMCU - named as slave receiver. I only changed the 'I2C_SLAVE' as '0x48' which is in CC430-side(master) I'm using this address as slave address. 

  • Did you reach the breakpoint at the switch() statement in the ISR? What did UCB0IV and UCB0IFG look like?

    Unfortunately, I don't have your equipment, but I did trip over a discussion at Github suggesting that many people are having trouble with the ESP8266 I2C Slave. The symptom described in each case is "doesn't work" (not very specific) so it's hard to tell whether it matches yours. The most recent entry was from last month:

    https://github.com/esp8266/Arduino/issues/5762

  • Yes , I can reach the switch statement. Beside I can reach the vector flag 12 - which is TXIFG and I can see that TXBUF load the value which to be transmitted. After that point I couldn't see the value on the NodeMCU. Do you think it's about NodeMCU problem? 

  • Without pointing fingers, it would be unfortunate if you spent a lot of time diagnosing the CC430 side if the problem is actually in the ESP8266.

    Reading through that thread left me with considerable doubt that they had even figured out what was wrong. There is some mention of sensitivity to clock-stretching, and the CC430 I2C certainly does clock-stretching. There's also some mention of running the ESP8266 CPU faster.

    The (probable) point of interest on the CC430 side is UCNACKIFG. That won't appear until after TXBUF is loaded the first time. The Example doesn't enable UCNACKIE, so it won't generate a call to the ISR, but once the CC430 side has stalled in the transaction you should be able to see it in the UCB0IFG register. The slave addressing looks correct, so if the ESP8266 is NACK-ing, that implies a deeper problem.

     Can you accomplish what you want by (only) using the ESP8266 as a master? It sounds like you were succeeding with that.

  • Dear Bruce ,

    Thank you a lot for your attention to the question. I decided to use UART because I noticed that I2C slave operation on NodeMCU is very problematic. Lots of people had deal with this problem without reaching any solution. I wouldn't like to spend more time for that operation. It's obvious this problem is not related with CC430, it's related with NodeMCU.

    Kind regards.

  • Hi Bruce,

    Thank you for helping answering the questions.

    Hi Huseyin,

    As the problem has been solved. I will close this thread.

    Eason

  • Hi Eason ,

    Problem couldn't solve but problem isn't about CC430  , you can close the thread.

    Hüseyin

  • Get it. Wish you good luck.

**Attention** This is a public forum