Hello,
I have a problem with the CI2C1_SendBlock () function.
I only get the address printed on the bus and then the controller gets stuck while waiting for the end of the transfer.
If I take the example of the I2C from the demo board, everything works. Just not if I use the function from Processor Expert.
Does anyone have any idea what’s going wrong?
When I look at the sending routine, I miss the loop of sending multiple, but I’m not sure. Some people would’ve noticed that.
Thanks
BR96
Solved! Go to Solution.
Hello Daniel,
thank you, now it’s work
But I don’t quite understand it.
I copied the code from the example to the method in Codeworier, so I assumed that it works.
As a value for the Err came the message BusOFF
now i will go on with my projekt
Hello @BR96,
Can you please scope the bus and share it?
Does the Slave acknowledge the address?
What is the baudrate?
How the signal differs in comparison to the signal of the working demo?
Is the Slave holding the bus low after it receives the address?
Thank you,
Daniel
Hey Daniel,
Hello Thorsten,
Please use external pull-up resistors instead of the internal ones that are too weak.
UM10204 I2C-bus specification and user manual
7.1 Pull-up resistor sizing
https://www.nxp.com/docs/en/user-guide/UM10204.pdf
In the I2C offen image, the address is not acknowledged by the slave.
Is the address correct?
BR, Daniel
Hi Danie,
i use now external Pullups... it works with the Demo to the Board. Its the same as befor.
When i switch the Hardware to use the Methods, it works agein with the sampelcode
but when i use the method
/* Set slave address */
(void)CI2C1_SelectSlave(SLAVE);
/* Clear "Complete" flag */
flags = 0;
/* Send bytes in master mode */
err=CI2C1_SendBlock(&Data,2,&ret);
if(err!=ERR_OK) {
/* Handle an error */
}
/* Wait for communication complete */
while(!flags) ;
it stops at while (!flags)
the Adrres is OK and i get a ACK see picture but its only the Adress no data
i dont understand it
Thanks for help
Thorsten
Hello Thorsten,
Please read the description of CI2C1_SendBlock() in CI2C1.c
"If interrupt service is enabled and the method returns ERR_OK,
it doesn't mean that transmission was successful.
The state of transmission is detectable by means of events (OnTransmitData, OnError or OnArbitLost)."
Please try the polling method:
Regards,
Daniel
Hello Daniel,
thank you, now it’s work
But I don’t quite understand it.
I copied the code from the example to the method in Codeworier, so I assumed that it works.
As a value for the Err came the message BusOFF
now i will go on with my projekt
Thanks,
i wilt try it tomorow. i am out of office to day
at the I2C offen image is the bus open! with out a Slave. its only to see that the controller send massage
i find out i get as erro
#define ERR_BUSOFF 12U /* Bus not available. */
but i send befor i start
CI2C1_Enable();
When i youse the exampel for the Demoboard it works with the same Hardware an i get a ACK with 0
Have same help?
Thanks