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.

TM4C and RF430CL330H

Other Parts Discussed in Thread: DLP-RF430BP, RF430CL330H, EK-TM4C1294XL

Hello there!

I'm trying to work with RF430CL330H (from DLP-RF430BP v1.1) and my launchpad (EK-TM4C1294XL), but until now I've got no sucess... I'm using I2C communication and Tivaware (ROM functions). In fact, even with RF430 datasheet, I'm not sure if my I2C routine is correct... well, let me explain what I did:

- I2C7 is in use (Boosterpack 2), in polling mode;

- Tiva's clock = 120 MHz and I2C's data rate = 100 kbps;

- After I2C configuration, there's a pulse in nRST (L-H);

- Delay (25 ms);

- Read STATUS_REG, for READY bit (while).

This is my I2C's reading routine, where NFC_SLAVE_ADDR is equal to 0x14 (right shiffed 0x28):

uint32_t Read_Register(uint32_t reg_addr)
{
uint8_t TxAddr[2];
uint8_t RxData[2] = {0,0};

    TxAddr[0] = reg_addr >> 8;      // MSB of address
    TxAddr[1] = reg_addr & 0xFF;    // LSB of address

    delayUs(5);

    //++ I2C Master is initiating a writes to the slave ++
    ROM_I2CMasterSlaveAddrSet(I2C7_BASE, NFC_SLAVE_ADDR, false);

    // Place the first byte to be sent in the data register
    ROM_I2CMasterDataPut(I2C7_BASE, TxAddr[0]);
    ROM_I2CMasterControl(I2C7_BASE, I2C_MASTER_CMD_BURST_SEND_START);
    // Delay until transmission completes
    while( ROM_I2CMasterBusy(I2C7_BASE) ){}

    // Place the second (last) byte to be sent in the data register
    ROM_I2CMasterDataPut(I2C7_BASE, TxAddr[1]);
    ROM_I2CMasterControl(I2C7_BASE, I2C_MASTER_CMD_BURST_SEND_CONT);
    // Delay until transmission completes
    while( ROM_I2CMasterBusy(I2C7_BASE) ){}

    delayUs(5);

    //++ I2C Master is initiating reads from the slave ++
    ROM_I2CMasterSlaveAddrSet(I2C7_BASE, NFC_SLAVE_ADDR, true);

    // Read first byte from the master
    ROM_I2CMasterControl(I2C7_BASE, I2C_MASTER_CMD_BURST_RECEIVE_START);
    // Delay until reception completes
    while( ROM_I2CMasterBusy(I2C7_BASE) ){}
    RxData[0] = (uint8_t)ROM_I2CMasterDataGet(I2C7_BASE);

    // Read second (last) byte from the master
    ROM_I2CMasterControl(I2C7_BASE, I2C_MASTER_CMD_BURST_RECEIVE_FINISH);
    // Delay until reception completes
    while( ROM_I2CMasterBusy(I2C7_BASE) ){}
    RxData[1] = (uint8_t)ROM_I2CMasterDataGet(I2C7_BASE);

    delayUs(5);

    return( (RxData[1] << 8) | RxData[0] );
}

The problem is that "RxData" is always returning 0x0000, even with others registers, like VERSION_REG.

Does anyone know what is happening?

Thanks a lot!

  • Hello Pedro

    Can you please replace

    while( ROM_I2CMasterBusy(I2C7_BASE) ){}

    with
       while(!( ROM_I2CMasterBusy(I2C7_BASE) )){}
    while( ROM_I2CMasterBusy(I2C7_BASE) ){}

    Amit

  • Hello Amit, thanks for your help!

    Well, I applied your suggestion, but without luck. But when I've replaced only the first two "while" (master writing), the function returned "0xFFFF" instead "0x0000"! Also, I've tried to add uDelays between writing, getting the same result. This looks like some kind of timing issue, but unfortunately I don't have a scope to see the signal...

    Any other idea?

  • Pedro said:

    Any other ideas?

    Minus proper test gear - you're in a difficult spot.

    Now that, "RF430" device is not especially easy to, "wrestle" into operation.  Thus we don't know if your issue involves RF430 or the MCU - or both!

    Amit's I2C code suggestion is, "known to work" (though an unfortunate/major change - to all past I2C code here!) and that suggests to me that you may benefit from a more basic test scenario.  Suggest you acquire a small, simple, I2C based EEPROM - and get that to accept both, I2C "reads & writes."  This will confirm that your MCU side is understood & well implemented. 

    Only then would I switch to the RF430 - and engage that battle...  Too many, "enemies" lurk - your present battle field!

  • Hello!

    Well, it turns to be errors not from I2C! First, the SLAVE_ADDRESS was wrong (I read somewhere it should be shifted right... well, but not in this case!), and because many tests I made, "RxData[0]" and "RxData[1]" from Read_Register function were swapped. Applying these correction and Amit's suggestion (also, without uDelays), now RF430 is working fine!

    Thanks for your help!