Hello Matrix Team,
I´m trying to Setup two I2C CAL slave ports with PIC18F6722 in Hardware Support.
#1 port should reply on the hex adress 0x72 and #2 port should work on I2C adress 0x73.
Each port is working on it´s own eparate but if I initialize the two ports at a time the communication stops.
No clock and no data signals are visible anymore.
Any ideas what could be wrong??
I2C Cal with PIC18F6722
Moderator: Benj
-
- Posts: 99
- Joined: Fri Feb 02, 2007 3:54 pm
- Location: Germany
- Has thanked: 14 times
- Been thanked: 12 times
- Contact:
-
- Valued Contributor
- Posts: 2045
- Joined: Wed Aug 27, 2008 10:31 pm
- Location: Netherlands
- Has thanked: 553 times
- Been thanked: 1081 times
- Contact:
Re: I2C Cal with PIC18F6722
Please read this post. One of the items is a request to post the flowchart with issues as it helps us understand what you are doing (sequence of macros, settings etc).
“Integrity is doing the right thing, even when no one is watching.”
― C.S. Lewis
― C.S. Lewis
-
- Posts: 99
- Joined: Fri Feb 02, 2007 3:54 pm
- Location: Germany
- Has thanked: 14 times
- Been thanked: 12 times
- Contact:
-
- Posts: 99
- Joined: Fri Feb 02, 2007 3:54 pm
- Location: Germany
- Has thanked: 14 times
- Been thanked: 12 times
- Contact:
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: I2C Cal with PIC18F6722
Hi Dirk,
When implementing a slave device, you need to init (as you have) and then call Slave_Status to test if there is an incoming request.
If there is, then use Slave_RxByte to read it. Then you can use RxByte and/or TxByte depending upon your application.
You should not be attempting a Slave_TxByte as the first step.
When implementing a slave device, you need to init (as you have) and then call Slave_Status to test if there is an incoming request.
If there is, then use Slave_RxByte to read it. Then you can use RxByte and/or TxByte depending upon your application.
You should not be attempting a Slave_TxByte as the first step.
-
- Posts: 99
- Joined: Fri Feb 02, 2007 3:54 pm
- Location: Germany
- Has thanked: 14 times
- Been thanked: 12 times
- Contact:
Re: I2C Cal with PIC18F6722
Hello Leigh,
many thanks for your fast reply.
If I refer to the FC I2C help file discription on Slave Status, it is possible to get the follwing return values/informations out of this:
0x00 = No data or address to read out of the buffer. Just nothing to get!!
0x01 = Address to read out of the buffer
0x21 = Data to read out of the buffer
Is this right?
BR
Dirk
many thanks for your fast reply.
If I refer to the FC I2C help file discription on Slave Status, it is possible to get the follwing return values/informations out of this:
0x00 = No data or address to read out of the buffer. Just nothing to get!!
0x01 = Address to read out of the buffer
0x21 = Data to read out of the buffer
Is this right?
BR
Dirk
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: I2C Cal with PIC18F6722
Hi Dirk,
Bit 0 = 1 Indicates address/data byte available in the buffer to read
Bit 5 = 1 Indicates that the last byte received or transmitted was data (else address)
So, yes, but best to test the bits individually, others can be undefined
Hope that helps,
Leigh
Bit 0 = 1 Indicates address/data byte available in the buffer to read
Bit 5 = 1 Indicates that the last byte received or transmitted was data (else address)
So, yes, but best to test the bits individually, others can be undefined
Code: Select all
if (return & 0x01)
{
// address or data byte available
if (return & 0x20)
{
// the last byte received or transmitted was data
}
else
{
// the last byte was an address
}
}
Leigh
-
- Posts: 1
- Joined: Mon Jun 13, 2016 5:01 pm
- Contact:
Re: I2C Cal with PIC18F6722
[quote="Dirk Bubley"][/quote]
Hello, how is your project? Could you share a part of the project (which is initialized i2s slave and how to organize data reception?
Thank you.
Hello, how is your project? Could you share a part of the project (which is initialized i2s slave and how to organize data reception?
Thank you.