Other Parts Discussed in Thread: TMP102
(I tried adding t my previous thread, but your system would not let me)
I am having errors when putting my setup into BIST mode
I have a little tool that lets me create a script of CLI commands.
Ignore the number in the SCRIPT() macro - it is used to create a unique symbol and could be anything.
The setup is: I2C_master -- 947 -- 926. The I2C_master is the one running the commands. I also sometimes use a TMP102 breakout from Sparkfun to test the I2C link to an I2C slave to test the entire chain. Not used in this test, but the code to set it up is still in the script
The 947 address is xC0; the 926 is xC2 - the same defaults on the eval boards
// script_947_BIST.h
// to setup the I2C channel on the 947 SER to the 926 DES
// then setup BIST
//
// format of macro: SCRIPT( UNIQUE_ID, STRING )
// where
// UNIQUE_ID is some unique set of chars - using numbers
//
// "master-wr-rd <slave_addr> <rd_count> <1..7 data>"
// "master-wr <slave_addr> <1..7 data>"
// "master_rd <slave_addr> <num_bytes>"
//
// ======================================================================
// this is just to setup the 947 as the I2C device as primary
// and the ability of the 947 to talk to the 926
// We are onnected to the 947
// ======================================================================
SCRIPT( 1, "iic-master" ) // just make sure
SCRIPT( 10, "iic-wrrd x0C 1 x00" ) // read 1 byte from reg 0 // DEV ID
// reg 0x03 default = 0xD2 = 1101 0010
// bit val meaning
// x80 x80 enable back channel CRC checker
// x40 x40 reserved - why set??
// x20 x00 == 0 do not auto ACK
// x10 x10 == enable filtering on DE/HS/VS inputs relative to PCLK
// x08 x08 == pass thru all known slave addr
// x04 x00 == reserved
// x02 x02 == use internal osc if PCLK fails
// x01 x00 == reserved
// result xDA
SCRIPT( 40, "iic-wr x0C x03 xDA" ) // reg x03 = xDA
SCRIPT( 50, "iic-wrrd x0C 1 x06" ) // read DES DEV ID
// reg x07 == slave ID[0] - the DES "8-bit" I2C address
// reg x07 == slave Alias[0] - the DES "8-bit" I2C address
// this lets us talk to the DES
SCRIPT( 60, "iic-wr x0C x07 x58" ) // Slave ID[0]
SCRIPT( 70, "iic-wr x0C x08 x58" ) // Slave Alias[0]
// We are using a TMP102 breakout board from Sparkfun as an easy I2C slave
// it's 7-bit address is x48; shifted left into an 8-bit addr == x90
// registers x70 and x77 are the ID[1] and Alias[1] registers, respecively
SCRIPT( 80, "iic-wr x0C x70 x90" ) // Slave ID[1] = TMP102 8-bit addr
SCRIPT( 90, "iic-wr x0C x77 x90" ) // Slave Alias[1] = TMP102 8-bit addr
// Reg xC2 == CFG register
// The default value == x80, which sets the ENH_LV bit:
// Enable Enhanced Link Verification
// basically, does a check on the SER-link-DES connection
//
// bit x20 == TX_RPTR, which allows the SER to be a repeater for I2C msgs
// x80 | x20 == xA0
//SCRIPT( 100, "iic-wr x0C xC2 xA0" ) // set the CFG register
// read the two ID registers
SCRIPT( 103, "read 947 ID str" )
SCRIPT( 104, "iic-wrrd x0C 6 xF0" ) // read the ID string 947
SCRIPT( 105, "read 926 ID str" )
SCRIPT( 106, "delay 100" ) // delay to see if it helps
SCRIPT( 107, "iic-wrrd x2C 6 xF0" ) // read the ID string 926
SCRIPT( 108, "delay 100" ) // delay to see if it helps
// ======================================================================
// we have a good connection from the 947 to the 926
// ======================================================================
// now enable the BIST on the '947
// x14 = 0x05 100 MHz clock, BIST enabled
// ***** Note: the 947 (local) BIST err count is x1B ********
SCRIPT( 110, "iic-wr x0C x14 x05" ) // local 947 into BIST mode
// see if w can read the other side
SCRIPT( 114, "delay 100" ) // delay to see if it helps
SCRIPT( 115, "iic-wrrd x2C 6 xF0" ) // read the ID string 926
SCRIPT( 116, "delay 100" ) // delay to see if it helps
SCRIPT( 117, "iic-wrrd x0C 6 xF0" ) // read the ID string 947
//
// then try for errors
// TI recommends setting the '947 DES registers :
// x44 bit 0 = 1 disable adaptive EQ
// x44 bits 7..5 (0xE0) feom 0x00 to 0xE0
// then x44 bits 3..1 = from 0x00 to 0x0E
//SCRIPT( 117, "BIST ON" )
//SCRIPT( 118, "iic-wr x2C x24 x03" ) // AEQ = off; set stage 1=0E
SCRIPT( 120, "AEQ = 0; range max; read count" )
SCRIPT( 121, "iic-wr x2C x44 x0F" ) // AEQ = off; set stage 1=0E
SCRIPT( 125, "READ BIST COUNT" )
SCRIPT( 126, "iic-wrrd x2C 1 x25" )
SCRIPT( 130, "AEQ = 0; range max; read count" )
SCRIPT( 131, "iic-wr x2C x44 x0F" ) // AEQ = off; set stage 1=0E
SCRIPT( 135, "delay 3000" ) // abide
=====================================================================
This is the result of the run, with annotations
Starting the serial command line
Note: this is the help: (number in brackets are the expected/minimum number of args)
defined commands:
function [args] help
iic-master [0] init I2C master
iic-slave [1] init I2C slave+addr
iic-wr [2] master-wr <slave_addr> <1..7 data>
iic-wrrd [2] master-wr-rd <slave_addr> <rd_count> <1..7 data>
iic-rd [2] master_rd <slave_addr> <num_bytes>
delay [1] delay <count>
****cmd> script
first make sure this is the I2C master
Note this is code running on an Adafruit mini-pro using the I2C hardware
iic-master
initing I2C master
===========================================================================
This reads the 947 I2C addres from the local device
****cmd> iic-wrrd x0C 1 x00
read count: 1; rd_buf: 18
===========================================================================
This sets up the I2C back channel to the 926
****cmd> iic-wr x0C x03 xDA
slave_addr C; num_data 2; data (hex): 3, DA,
===========================================================================
this reads the I2C address of the remote 926 DES - "58" (hex) is correct
****cmd> iic-wrrd x0C 1 x06
read count: 1; rd_buf: 58
===========================================================================
These setup the slave ID/Alias registers for the DES on the local 926 SER
****cmd> iic-wr x0C x07 x58
slave_addr C; num_data 2; data (hex): 7, 58,
****cmd> iic-wr x0C x08 x58
slave_addr C; num_data 2; data (hex): 8, 58,
===========================================================================
Read the local 947 ID string to show we can see ourselves
****cmd> iic-wrrd x0C 6 xF0
read count: 6; rd_buf: 5F 55 42 39 34 37 - correct
===========================================================================
now read the remote 926 ID string.
****cmd> delay 100
****cmd> iic-wrrd x2C 6 xF0
read count: 0; rd_buf: 14 C 54 2 D2 5
It failed. However, if there is a delay , then sometimes read correct:
****cmd> delay 100
****cmd> iic-wrrd x2C 6 xF0
write data (hex): F0,
read count: 6; rd_buf: 5F 55 42 39 32 36
===========================================================================
into BIST mode on the local 947 side
****cmd> iic-wr x0C x14 x05
===========================================================================
and we are back to reading trash for the remote 926 ID string
****cmd> iic-wrrd x2C 6 xF0
read count: 0; rd_buf: B8 3 A 0 2 0
===========================================================================
but the local 947 is fine
****cmd> iic-wrrd x0C 6 xF0
read count: 6; rd_buf: 5F 55 42 39 34 37
===========================================================================
now things are realy downhill
AEQ = 0; range max; read count
****cmd> iic-wr x2C x44 x0F
slave_addr 2C; num_data 2; data (hex): 44, F, error write reg xFFFFFFFE: I2C_ERR_NACK_ADDR
===========================================================================
this is after the NACK_ADDR - nothing should be trusted
Takes a complete power cycle ofboth 947 and 926 to restore o a trustworthy state
notice a read count of 0
This might also be an artifact of the way the Arduino I2C "Wire" library works
but don't know if I can trust the (hex) count of 54
READ BIST COUNT
****cmd> iic-wrrd x2C 1 x25
write data (hex): 25,
read count: 0; rd_buf: 54
===========================================================================
AEQ = 0; range max; read count
****cmd> iic-wr x2C x44 x0F
slave_addr 2C; num_data 2; data (hex): 44, F, error write reg xFFFFFFFE: I2C_ERR_NACK_ADDR
****cmd> delay 3000
===========================================================================
(back to your normal scheduled show)
SO I am basically stuck. The most troubling aspect is going into BIST mode wipes out the I2C backchannel.
I can only assume I am not properly going into I2C mode on the 947 to 926, or not properly going into BIST mode. The eval boards are set to the factory defaults.
Please note I get similar results on the 913/914 link where I connect to the 914 DES because that is where my smarts is in my system.
The only other thing I can think of is to see if the /PASS output strobes.
I can also look to see if this is a clock-stretching issue - I will check that today.
Thanks ... bandit