Why is OnMasterBlockSent not called?

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

Why is OnMasterBlockSent not called?

739 Views
DustyStew
Contributor V

Codewarrior 10.4

K20 MCU

I am setting up the I2C port using PE. Master Mode. I call I2C1_MasterBlockSend() to send 4 bytes with SendStop = 1. It returns ERR_OK. I have a breakpoint in the OnMasterBlockSent event handler. Never gets there. The event code is being generated, and the Event Mask has the event enabled.

Any ideas of what other factor is preventing the event function to be called?

TIA

0 Kudos
3 Replies

547 Views
VinGanZ
Contributor III

Hello,

I am also having the same problem on a custom board with KL25. I am able to send slave address+1 byte and after that the I2C interrupt does not fire. The interrupt never goes above sending more than 1 byte. OnMasterBlockSent is never called. There are no errors generated from OnError() function i verified that the error section on the interrupt is not reached confirming the same.  what i have observed is

1. The slave address is loaded to I2C Data register.

2. The above step succesfully generates an interrupt

3. The ISR loads the 2nd byte and then no further interrupt is generated.

Any clue?

Thanks in advance

Vinod

0 Kudos

547 Views
jiri_rezler
NXP Employee
NXP Employee


Hello,

OnMasterBlockSent() event is called in case, when all send data by MasterBlockSend() method were correctly transmitted to a slave device (Slave device send acknowledge on address/data byte) => it is runtime error type. Runtime type errors are possible to detect by OnError() event & GetError() method. GetError() method returns error code mask.

I think that your problem would be in "acknowledge" from a slave device.

Possible issues:

- slave device is not available on I2C BUS.

- master sent wrong slave address value.

- master bit clock is too fast.

Best regards,

Jiri Rezler

0 Kudos

547 Views
DustyStew
Contributor V

Thank you Jiri.

I found a solution. The problem went away when I turned off auto-initialization in PE. While I was calling I2C1_Init() in my code, nevertheless, I gather PE was generating code to do the same.

BTW another small point, regarding documentation: it is not clear whether the slave address includes the R/W bit. It worked when I set the address for no R/W bit (eg 0x0A not 0x14). The documentation does not make this clear. Ultimately that problem is due to the fact the designers of I2C chose to use a naming convention that included the R/W bit in the "address", breaking with tradition.

0 Kudos