Fetch Slave Address in RA6M5 Controller

Hi team,

Am using RA6M5 microcontroller, we have 3 I2C interfaces in this microcontroller, Here i have simulated I2C scenario... Here are the following steps : 

1) Created a stack of type r_iic_master and used the pins P409(SDA) and P410(SCL)
2) Created another stack of type r_iic_slave and used the pins P511(SDA) and P512(SCL)
Note: I just want to use the I2C communication protocol in the same Microcontroller..(I dont want any external device to connect) 
Here i have used the jumper wires to connect SDA and SCL lines from Master to Slave.... In the configuration part, i am supposed to provide Slave address, Can you kindly help me on what slave address is to be provided under Master and Slave stack ?
I am attaching the project in to this mail... Kindly look into it and let me know for any queries

Thanks & regards,

Vikram

I2C_PROTOCOL.zip

  • Hello Vicram,

    Thanks for reaching out Renesas Community!

    Yes, you should provide a slave address, as you have already done by using 0x4A both at master and slave stack.

    Regards,

    AL_Renesas

  • Thanks for the update, Here I have updated 0x4A as slave address in both Master and Slave stacks... I did this by seeing the example...

    1)My question is how to find Slave address...I mean what process should be followed to get the Slave address ?

    2) In the example project provided earlier... the I2C functionality is not working... whenever am passing the date from Master to slave using Write function...The status in the callback function of Master is getting updated as "I2C_MASTER_EVENT_ABORTED" (the first enum value of event)...

    Request you to please help me out with the above two queries... And let me know if you have any queries....

    Thanks,

    Vikram 

  • Hello Vikram,

    I tested your code on EK-RA6M5, changing the channel of master  and the pins, because SDA and SCL should be used with pull-up resistors, and it was executed successfully, take a look below:

    First of all, check if you use pull-up resistors on the pins.

    Also, there is a wrong configuration on your clocks, take a look below:

    PLL frequency should be between 120 and 200MHz.

    Also, find attached my project for EK-RA6M5:

    I2C_PROTOCOL_MODIFIED.zip

    Regards,

    AL_Renesas

  • Hi Vikram,

    You specify the slave address in the configuration properties of the slave.

    Slave address should not change at runtime... that is the address this slave responds to.

    For the master, which can talk to many slaves, you set this at runtime for whichever slave you want to talk to.