06-12-2004 08:03 PM
06-14-2004 07:17 AM
06-15-2004 10:55 AM
06-15-2004 01:37 PM
06-15-2004 11:56 PM
06-16-2004 07:19 AM
05-25-2009 08:12 AM - edited 05-25-2009 08:14 AM
I have the same trouble with my designed TNT4882 Board like this, with M&A Explorer and ENOL Error. I have had developed GPIB Talkter/listener Card based on TNT4882 Chip. Till developement process i did used an Agilent GPIB-USB controller and all things were fine. Since I use NI controller and M&A Explorer I found this error. This problem seems to be controller idepended but depended on used Software. Agilent Connection Expert is able to write more than one message without reads (its doesnt matter if I use Agilent or NI GPIB-USB controller). NI M&A Ex. throws an Error if I try one new write without read.
// main.c
gpib_addr_state = TNT_In(R_ADSR);
if(gpib_addr_state & B_TA) { // addressed to talk
tnt4882_send_data();
}
else
if(gpib_addr_state & B_LA) { // addressed to listen
tnt4882_receive_data();
}
//#########################################################
// tnt4882_driver.c
unsigned char tnt4882_receive_data(void) {
static u16 counted_bytes = 0;
u8 isr3;
u16 max_trials = 500;
// printf("\r\nListen: ");
tnt4882_setup_read();
while(!(TNT_In(R_ISR3) & E_DONE) ){
while (((isr3 = TNT_In(R_ISR3)) & E_NEF) && max_trials > 0) {
char_arr[counted_bytes] = TNT_In(R_FIFOB);
counted_bytes++;
max_trials--;
}
}
isr3 = TNT_In(R_ISR3);
if (isr3 & E_DONE) {
if ((char_arr[counted_bytes - 1] == '\r') || (char_arr[counted_bytes - 1] == '\n')) {
char_arr[counted_bytes - 1] = '\0'; // replace '\n' with '\0'
}
else {
char_arr[counted_bytes] = '\0';
}
if (!global_flag.received) {
gpib_cmd = &char_arr[0];
global_flag.received = 1;
global_flag.gpib_rxrdy = 1;
}
counted_bytes = 0;
}
TNT_Out(R_CMDR, STOP);
TNT_Out(R_CMDR, RstFIFO);
// Clear Error status bit
TNT_Out(R_AUXMR, ClrERR);
// Clear End status bit
TNT_Out(R_AUXMR, ClrEND);
// clear time out condition
TNT_Out(R_AUXRJ, 0x00);
// Clear Power-On Local message
TNT_Out(R_AUXMR, 0x00);
if (!max_trials) tnt4882_init();
return 1;
}
void tnt4882_setup_read(void) {
//######## 1) Reset Fifo Register
TNT_Out(R_CMDR, RstFIFO);
//######## 2) Set B_tlchlte to halt when interrupt condition sets and B-in for In
TNT_Out(R_CFG, (B_tlchlte | B_in));
//######## 3) Load Data Count Registers: max. 128 bytes
TNT_Out(R_CNT0, 0x01);
TNT_Out(R_CNT1, 0x00);
TNT_Out(R_AUXMR, 0x86); // holdoff on EOS
//######## 4)
TNT_Out(R_IMR1, E_END); // End byte detection
//######## 5) Send Go Command
TNT_Out(R_CMDR, 0x04);
//######## 6) Send Go Command
TNT_Out(R_IMR3, (E_TLCINT | E_NEF | E_DONE)); // Enable Intrrupts from ISR0 and ISR1
//######## 7) Issue Release Holdoff
TNT_Out(R_AUXMR, RHDF);
//######## Set Timeout Condition to 1ms
TNT_Out (R_AUXRJ, 0x05);
}
The programming of tnt4882 makes me creasy so I was very happy about since I was ready, but now...
I tried to read ISR2 but this seems not to be usefull for my problem. Someone an idea?
thx.
05-25-2009 09:18 AM
I found following things:
TNT4882 is not responsible for new data if tnt4882_init() condition is not done.
here are the TNT4882 Register Bytes captchured in read function after "TNT_Out(R_AUXMR, ClrEND);"
Addr 0(0) Byte: 0XA
Addr 1(0X1) Byte: 0XFF
Addr 2(0X2) Byte: 0X2
Addr 3(0X3) Byte: 0XFF
Addr 4(0X4) Byte: 0X13
Addr 5(0X5) Byte: 0XFF
Addr 6(0X6) Byte: 0X99
Addr 7(0X7) Byte: 0XFF
Addr 8(0X8) Byte: 0X4A
Addr 9(0X9) Byte: 0XFF
Addr 10(0XA) Byte: 0X2A
Addr 11(0XB) Byte: 0XFF
Addr 12(0XC) Byte: 0X7
Addr 13(0XD) Byte: 0XFF
Addr 14(0XE) Byte: 0XE0
Addr 15(0XF) Byte: 0XFF
Addr 16(0X10) Byte: 0XAB
Addr 17(0X11) Byte: 0X2A
Addr 18(0X12) Byte: 0X7
Addr 19(0X13) Byte: 0
Addr 20(0X14) Byte: 0X7
Addr 21(0X15) Byte: 0
Addr 22(0X16) Byte: 0
Addr 23(0X17) Byte: 0X3C
Addr 24(0X18) Byte: 0X2A
Addr 25(0X19) Byte: 0XFF
Addr 26(0X1A) Byte: 0X99
Addr 27(0X1B) Byte: 0X60
Addr 28(0X1C) Byte: 0X9A
Addr 29(0X1D) Byte: 0X3D
Addr 30(0X1E) Byte: 0
Addr 31(0X1F) Byte: 0X21
06-24-2009 04:04 AM