Electronic Components Datasheet Search
  English  ▼

X  

CP3UB26 Datasheet(PDF) 182 Page - National Semiconductor (TI)

[Old version datasheet] Texas Instruments acquired National semiconductor.
Part # CP3UB26
Description  Reprogrammable Connectivity Processor with USB and CAN Interfaces
PDF  268 Pages
Scroll/Zoom Zoom In 100%  Zoom Out
Manufacturer  NSC [National Semiconductor (TI)]
Direct Link  http://www.national.com
Logo NSC - National Semiconductor (TI)

CP3UB26 Datasheet(HTML) 182 Page - National Semiconductor (TI)

Back Button CP3UB26 Datasheet HTML 178Page - National Semiconductor (TI) CP3UB26 Datasheet HTML 179Page - National Semiconductor (TI) CP3UB26 Datasheet HTML 180Page - National Semiconductor (TI) CP3UB26 Datasheet HTML 181Page - National Semiconductor (TI) CP3UB26 Datasheet HTML 182Page - National Semiconductor (TI) CP3UB26 Datasheet HTML 183Page - National Semiconductor (TI) CP3UB26 Datasheet HTML 184Page - National Semiconductor (TI) CP3UB26 Datasheet HTML 185Page - National Semiconductor (TI) CP3UB26 Datasheet HTML 186Page - National Semiconductor (TI) Next Button
Zoom Inzoom in Zoom Outzoom out
 182 / 268 page
background image
www.national.com
182
23.4.1
Avoiding Bus Error During Write Transaction
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
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.
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
; NAME: ACBRead
Reads "Count" byte(s) from selected I2C Slave.
If read address differs from previous
;
Read or Write operation (as recorded in NextAddress), a "dummy" write transaction is
;
initiated to reset the address to the desired location.
This is followed by a repeated
;
Start sequence and the Read transaction.
All transactions begin with a call to ACBStartX
;
which sends the Start condition and Slave address.
Checks for errors throughout process.
;
; PARAMETERS:
UBYTE
Slave
-
Slave Device Address. Must be of format 0xXXXX0000
;
UWORD
Addrs
-
Byte/Array address (extended addressing mode uses two byte address)
;
UWORD
Count
-
Number of bytes to read
;
UBYTE
*buf
-
Pointer to receive buffer
;
; CALLS:
ACBStartX
;
; RETURNED: error status
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
UWORD
ACBRead (UBYTE Slave, UWORD Addrs, UWORD Count, UBYTE *buf)
{
ACB_T
*acb;
UBYTE
err, *rcv;
UWORD
Timeout;
acb =
(ACB_T*)ACB_ADDRESS;
/* Set pointer to ACB module
*/
/* If the indicated address differs from the last
*/
if (Addrs != NextAddress) {
/* recorded access (i.e. Random Read), we must first
*/
/* send a "dummy" write to the desired new address..
*/
NextAddress =
Addrs;
/* Update last address placeholder
*/
KeyInit();
KBD_OUT &= ~BIT0;
/* Send start bit and Slave address...
*/
if ((err = ACBStartX (Slave | (Addrs >> 7 & 0x0E), ACB_WRITE, 0)))
return (err);
/* If unsuccessful, return error code
*/
//
KBD_OUT &= ~BIT0;
acb->ACBsda =
(UBYTE)Addrs;
/* Send new address byte
*/
KBD_OUT &= ~BIT0;
Timeout =
1000;
/* Set timeout
*/
/* Wait for xmitter to be ready...zzzzzzzzz
*/
while (!(acb->ACBst & ACBSDAST) && !(acb->ACBst & ACBBER) && Timeout--);
if (acb->ACBst & ACBBER) {
/* If a bus error occurs while sending address, clear
*/
acb->ACBst
|=
ACBBER;
/* the error flag and return error status
*/
return (ACBERR_COLLISION);
}
KBD_OUT &= ~BIT0;
if (!Timeout)
/* If we timeout, return error
*/
return (ACBERR_TIMEOUT);
}
/* (Re)Send start bit and Slave address...
*/
if ((err = ACBStartX (Slave | (Addrs >> 7 & 0x0E), ACB_READ, Count)))
/* If error, return
*/
return (err);
rcv =
buf;
/* Get address of read buffer
*/
/* Read Count bytes into user’s buffer
*/
while (Count) {
if (Count-- == 1)
/* If this the final byte, or only one requested, send
*/
acb->ACBctl1
|=
ACBACK;
/* the NACK bit after reception
*/
Timeout =
1000;
/* Set timeout
*/
while (!(acb->ACBst & ACBSDAST) && Timeout--);
if (!Timeout)
/* Timed out??
*/
/* YES - return error
*/
return (ACBERR_TIMEOUT);
*rcv++
=
acb->ACBsda;
/* NO - Read byte from Recv register
*/
/* Adjust current address placeholder
*/
NextAddress++;
}



Html Pages

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100  ...More


Datasheet Download

Go To PDF Page


Link URL



Does ALLDATASHEET help your business so far?  [ DONATE ] 

About Alldatasheet   |   Advertisement   |   Contact us   |   Privacy Policy   |   Link to Datasheet    |   Link Exchange   |   Manufacturer List
All Rights Reserved©Alldatasheet.com


Mirror Sites
English : Alldatasheet.com  |   English : Alldatasheet.net  |   Chinese : Alldatasheetcn.com  |   German : Alldatasheetde.com  |   Japanese : Alldatasheet.jp
Russian : Alldatasheetru.com  |   Korean : Alldatasheet.co.kr  |   Spanish : Alldatasheet.es  |   French : Alldatasheet.fr  |   Italian : Alldatasheetit.com
Portuguese : Alldatasheetpt.com  |   Polish : Alldatasheet.pl  |   Vietnamese : Alldatasheet.vn
Indian : Alldatasheet.in  |   Mexican : Alldatasheet.com.mx  |   British : Alldatasheet.co.uk  |   New Zealand : Alldatasheet.co.nz
Family Site : ic2ic.com  |   icmetro.com