This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

I2C Master transmission fails if I2C Slave Driver is added to the project stack (EK-RA2E1)

HI !

This can be easily verified with the I2C Master example. Example works, data is fine (valid I2C packet). After adding the slave driver (just adding in stacks without modification and generate), the same R_IIC_MASTER_Write fails: no valid start condition anymore!

The slave driver is not opened at all (no ...Slave_Open). Only the default example will be started again without any changes. The address byte can not be seen on the bus, only garbage with timeout. Lines are not released. The next Reset releases the lines.

Deleting the slave driver recovers this fail.

Installation: Win 10, e2Studio 2021-04 with FSP 3.10, also fails with 2.4.0, 3.0.0 and 3.0.1

It should be possible to switch between Master and Slave mode. What is wrong here?

Best regrards,

HaJo

Parents
  • I suspect the issue here is that when the I2C slave driver is added to the project configuration, only the slave I2C driver interrupt handlers are populated in the vector table (the below images are from an FSP 3.1.0 test project) :-

    What you could do is add user defined handlers for the IIC peripheral :-

    and then in the user defined handler redirect the handler to the actual required isr handler for the driver that is currently being used :-

    volatile bool g_iic_master = true;


    void iic_slave_eri_isr(void);

    void iic_user_txi_isr(void)
    {
        if (true == g_iic_master)
        {
            iic_master_txi_isr();
        }
        else
        {
            iic_slave_txi_isr();
        }
    }

  • Yes! This redirection works as expected!

    I am able to switch between master and slave without issues now.

    It depends on the order of appearance in the stack, just like you said. Master first, then slave -> master fails, slave driver first, master next -> slave communication fails - due to this combined ISR issue.

    Now it is obvious why this happens.

    Thank you!

  • Hi HaJo,

    As Jeremy's answer solved the issue, we will close this thread now. If you have another question, please create a new discussion. Thank you and have a nice day!

    JB
    RenesasRulz Forum Moderator

    https://renesasrulz.com/
    https://academy.renesas.com/
    https://en-support.renesas.com/knowledgeBase/

Reply Children
No Data