CI2C1_SendBlock() send only adress

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CI2C1_SendBlock() send only adress

Jump to solution
3,128 Views
BR96
Contributor II

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

0 Kudos
Reply
1 Solution
3,016 Views
BR96
Contributor II

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

View solution in original post

0 Kudos
Reply
8 Replies
3,101 Views
danielmartynek
NXP TechSupport
NXP TechSupport

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

0 Kudos
Reply
3,073 Views
BR96
Contributor II

Hey Daniel,

yes, I think he answers the address, because in the scope you find the bit OK.
The baudrate is 100k
at the sampel I can turn on the pull up for the pin in the chip, then it works. See the Scope pictuere.

If I go through the functions of Codeworier, I can’t set that the pull up for the pin. or i didn’t find it

The goal of the I2C is this demoboard of ISSI
 
the other side is this one
 
Thanks
 
Thorsten
0 Kudos
Reply
3,052 Views
danielmartynek
NXP TechSupport
NXP TechSupport

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

0 Kudos
Reply
3,032 Views
BR96
Contributor II

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

0 Kudos
Reply
3,022 Views
danielmartynek
NXP TechSupport
NXP TechSupport

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:

danielmartynek_0-1626337796237.png

 

Regards,

Daniel

0 Kudos
Reply
3,017 Views
BR96
Contributor II

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

0 Kudos
Reply
3,044 Views
BR96
Contributor II

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

0 Kudos
Reply
3,114 Views
BR96
Contributor II

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

0 Kudos
Reply