Quantcast
Channel: Forum - Recent Threads
Viewing all articles
Browse latest Browse all 5781

Reading out the TRS bit (I2C)

$
0
0

Hello!

 

I'm trying to read out the TRS bit from the ICCR2 register to determine if the slave is in a transmit or a receive mode.

 

My function looks like this:

__STATIC_INLINE bool HW_SMB_CheckTxRxMode (R_IIC0_Type * p_smb_reg)
{    
    // Transmit mode = true, Receive mode = false
    return (1 == p_smb_reg->ICCR2_b.TRS);
}

 

The readout is done after receiving the first byte after the address:

 

 

 

 

Now, in my code I want to use the results of it, but the result is always false, even that I'm pretty sure that the TRS bit is set to 1.

I'm debbuging the code, so I can see that the TRS bit is set to 1, before entering and after returning the function HW_SMB_CheckTxRxMode:

            /** Record if we have a receive (false) or transmit transfer (true)*/
            p_ctrl->read = HW_SMB_CheckTxRxMode(p_ctrl->p_reg);
            
            /** Set up the event correctly */
            if(p_ctrl->read)
            {
                event = SMB_EVENT_TX_REQUEST;
            }

So the line, where the variable event is set, is never reached...

 

Is there anything that I'm missing or doing wrong?

 

Thank you for any hints on this one.

 

Regards,

Gregor


Viewing all articles
Browse latest Browse all 5781

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>