??? 07/10/07 06:17 Read: times |
#141664 - silican labs SMBus and I2c problem f040 |
Hi, I mod'ed the smbus state machine to handle to a address greater than 255. The problem is then I perform two consecutive random reads the smbus hangs up.
I’m using the same routine for the read, but the exit points from the bus are different. The first time it exits from 50 the second pass it exits from case 58. Any help would be appreicated. // Status code for the SMBus // (SMB0STA register) switch (SMB0STA) { // Master Transmitter/Receiver: case SMB_START_08: SMB0DAT = EPROM_DEVICE_ID; SMB0DAT &= 0xFE; // Load R/W bit SMB0DAT |= SMB_RW; STA = 0; // Manually clear STA bit i = 0; break; // Master Transmitter/Receiver: // Repeated START condition case SMB_RP_START_10: SMB0DAT = EPROM_DEVICE_ID; . SMB0DAT |= SMB_RW; STA = 0; i = 0; break; // Master Transmitter: Slave address // + WRITE transmitted. // ACK received. case SMB_MTADDACK_18: // Hi addr has been send, // Flag it, to send low byte addrLowSendFlag = 1; SMB0DAT = CHAR_ADDR_HIGH; if (SMB_RANDOMREAD) { //Send a START after //the next ACK cycle SEND_START = 1; SMB_RW = READ; } break; ///-RANSMIT ROUTINES /// ///------------------/// // Master Transmitter: Slave // address + WRITE transmitted. NACK received. case SMB_MTADDNACK_20: if(SMB_ACKPOLL) { // Restart transfer STA = 1; } else { // Indicate failed transfer FAIL = 1; } break; // Master Transmitter: Data byte // transmitted. ACK received. case SMB_MTDB_ACK_28: // Has the Addr Hi byte been // sent, if Yes, send the //low byte, Flag it if (addrLowSendFlag) { SMB0DAT = CHAR_ADDR_LOW; //Reset the flag to skip addrLowSendFlag = 0; } else { if (SEND_START) { STA = 1; SEND_START = 0; break; } // Is this transfer a WRITE? if (SMB_RW==WRITE) { // Is there data to send? if (i < SMB_DATA_LEN) { SMB0DAT = SMB_SINGLEBYTE_OUT; i++; } else { // Set STO to terminte transfer STO = 1; // Clear software busy flag SMB_BUSY = 0; } } else {} // If this transfer is a READ, then // take no action, as a repeated // start will be generated for the // read operation } break; // Master Transmitter: Data //byte transmitted.NACK received. case SMB_MTDB_NACK_30: if(SMB_ACKPOLL) { STA = 1;// Restart transfer } else { FAIL = 1;// Indicate failed transfer } break; // Master Transmitter: Arbitration lost. case SMB_MTARBLOST_38: FAIL = 1; // Indicate failed transfer // and handle at end of ISR break; |
Topic | Author | Date |
silican labs SMBus and I2c problem f040 | 01/01/70 00:00 | |
Something missing? | 01/01/70 00:00 | |
updated post | 01/01/70 00:00 | |
Read it as single-byte variable array![]() | 01/01/70 00:00 | |
totally ambigous | 01/01/70 00:00 | |
now that you added f040 I suggest | 01/01/70 00:00 |