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.

F2013/ FG4618 I2C; receive buffer junk values

Hello,

On the Slave receiver end(FG4618), I wrote:

short rcv_buf_address = 0x6E; // the address for UCB0RXBUF
const short *rcv_buf = &rcv_buf_address;

host_data = *rcv_buf;

 

But all I receive is junk values,

Krishna.

  • Aehm, what do you want with this code?

    &UCBRXBUF is the address of UCBRXBUF. Which might (or might not, I didn't check, as it ias always defined in the header files) be 0x6e.

    &rcv_buf_address, however, is the memory location of the rcv_buf_address variable and point somewher einto the ram area.

    Now you let rcv_buf point to the address of the rcv_buf_address variable and then you read from where rcv_buf points to. Which would give, let's guess, 0x6e?

    Not to mention that UCB0RXBUF is an unsigned char and not a short.

    Why don't you just use
    host_data=UCB0RXBUF;
    ?

**Attention** This is a public forum