Sanity check on i2c pic16f1823

Discussion on both general simulation and Proteus VSM microcontroller simulation.
Post Reply
TimBox100
Professional User
Posts: 87
Joined: Wed 2019-03-13 13:26

Sanity check on i2c pic16f1823

Post by TimBox100 »

Hello team

I have VSM and code for a master talking to a slave using Pic18F13k22 as slave and master. It works very well

I converted the code over to the pic16f1823 for the slave and I'm getting odd results

Basically the Master requests data from the slave. The slave sees the address as it is for it and its a read request. The Status indicates as such (D_A=0,S=1,R/W=1,BF=0. Master Rx, slave addr+1)

On the 18f device and the 16f I'm using the SSPBUF is loaded with the first byte of data and the CLK line released The VSM sees this as a valid data and indicates there is an ACK.

The next packet the Status says it is a Data RX/TX with an NACK (D_A=1,S=1,R/W=0,BF=0. Master Rx, Data with NACK)

So the Slave says OK and ignores all data until the next Start

But the Master code has not changed Swap in a Pic18F13k22 and it works. It can RX more than 1 byte with no issues.

I can supply code and VSM for both versions if needed but not sure if you can check if see an issue in the VSM libs for i2c or even if you have any example i2c code running in a VSM with Master - Slave that I can look at.

Thanks

Tim
TimBox100
Professional User
Posts: 87
Joined: Wed 2019-03-13 13:26

Re: Sanity check on i2c pic16f1823

Post by TimBox100 »

Well I found the issue

I really hope I did not waste peoples time on this

The problem is that the master software i2c does not implement clock stretching so it was running too fast for the 32mhz Pic16F device

Thanks

Tim
Post Reply