cp3bt13 National Semiconductor Corporation, cp3bt13 Datasheet - Page 156

no-image

cp3bt13

Manufacturer Part Number
cp3bt13
Description
Cp3bt13 Reprogrammable Connectivity Processor With Bluetooth-r And Can Interfaces
Manufacturer
National Semiconductor Corporation
Datasheet
www.national.com
21.4.1
A Bus Error (BER) may occur during a write transaction if
the data register is written at a very specific time. The mod-
ule generates one system-clock cycle setup time of SDA to
SCL vs. the minimum time of the clock divider ratio.
The problem can be masked within the driver by dynamical-
ly dividing-by-half the SCL width immediately after the slave
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
; NAME: ACBRead
;
;
;
;
;
; PARAMETERS:
;
;
;
;
; CALLS:
;
; RETURNED: error status
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
UWORD
{
KBD_OUT &= ~BIT0;
KBD_OUT &= ~BIT0;
KBD_OUT &= ~BIT0;
//
ACB_T
UBYTE
UWORD
acb =
if (Addrs != NextAddress) {
KeyInit();
}
if ((err = ACBStartX (Slave | (Addrs >> 7 & 0x0E), ACB_READ, Count)))
rcv =
while (Count) {
}
KBD_OUT &= ~BIT0;
ACBRead (UBYTE Slave, UWORD Addrs, UWORD Count, UBYTE *buf)
NextAddress =
if ((err = ACBStartX (Slave | (Addrs >> 7 & 0x0E), ACB_WRITE, 0)))
acb->ACBsda =
Timeout =
while (!(acb->ACBst & ACBSDAST) && !(acb->ACBst & ACBBER) && Timeout--);
if (acb->ACBst & ACBBER) {
}
if (!Timeout)
return (err);
if (Count-- == 1)
Timeout =
while (!(acb->ACBst & ACBSDAST) && Timeout--);
if (!Timeout)
*rcv++
NextAddress++;
Avoiding Bus Error During Write Transaction
ACBStartX
*acb;
err, *rcv;
Timeout;
(ACB_T*)ACB_ADDRESS;
return (err);
acb->ACBst
return (ACBERR_COLLISION);
return (ACBERR_TIMEOUT);
buf;
acb->ACBctl1
return (ACBERR_TIMEOUT);
UBYTE
UWORD
UWORD
UBYTE
=
Reads "Count" byte(s) from selected I2C Slave.
Read or Write operation (as recorded in NextAddress), a "dummy" write transaction is
initiated to reset the address to the desired location.
Start sequence and the Read transaction.
which sends the Start condition and Slave address.
1000;
1000;
acb->ACBsda;
Slave
Addrs
Count
*buf
Addrs;
(UBYTE)Addrs;
|=
ACBBER;
|=
-
-
-
-
ACBACK;
Slave Device Address. Must be of format 0xXXXX0000
Byte/Array address (extended addressing mode uses two byte address)
Number of bytes to read
Pointer to receive buffer
/* Set pointer to ACB module
/* If the indicated address differs from the last
/* recorded access (i.e. Random Read), we must first
/* send a "dummy" write to the desired new address..
/* Update last address placeholder
/* Send start bit and Slave address...
/* If unsuccessful, return error code
/* Send new address byte
/* Set timeout
/* Wait for xmitter to be ready...zzzzzzzzz
/* If a bus error occurs while sending address, clear
/* the error flag and return error status
/* If we timeout, return error
/* (Re)Send start bit and Slave address...
/* If error, return
/* Get address of read buffer
/* Read Count bytes into user’s buffer
/* If this the final byte, or only one requested, send
/* the NACK bit after reception
/* Set timeout
/* Timed out??
/* YES - return error
/* NO - Read byte from Recv register
/* Adjust current address placeholder
156
address is successfully sent and before writing to the ACB-
SDA register. This has the effect of forcing SCL into the
stretch state.
The following code example is the relevant segment of the
ACCESS.bus driver addressing this issue.
All transactions begin with a call to ACBStartX
If read address differs from previous
Checks for errors throughout process.
This is followed by a repeated
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/

Related parts for cp3bt13