Ce contenu n’est pas disponible dans votre langue préférée.

Le contenu est disponible dans une autre langue. Votre navigateur peut inclure des fonctionnalités qui vous aideront à traduire le texte.

Error -301742 Occurred During USB-845x I2C- or SMBus-Communication

Updated Apr 26, 2023

Reported In

Hardware

  • USB-8452

Driver

  • NI-845x

Issue Details

I'm developing an I2C- or SMBus-communication program in LabVIEW with my USB-8451 or USB-8452 device. But I'm getting the below error and my communication is not working.
How can I fix this? What's the meaning of this error?

Error -301742 occurred

Possible reason(s):

NI-845x:  The slave did not acknowledge an address+direction byte transmitted by the I2C master.  If you are using ACK polling, consider increasing the timeout. Other reasons include the incorrect address set in the I2C configuration or the incorrect use of the 7-bit address. When entering an address to access a 7-bit device, do not include the direction bit. The NI-845x Basic I2C API internally sets the direction bit to the correct value, depending on the function (write or read). If your datasheet specifies the 7-bit device address as a byte, discard the direction bit (bit 0) and right-shift the byte value by one to create the 7-bit address.

Solution

This error occurs because the master transmits the wrong slave device's ID, so there is no ack signal from a slave device. Below are several solutions to sort this problem out:
  • As error message mentioned, please confirm the slave device's 7-bit address. By referring to your slave device's specification sheet, if the address is the 8-bit type, subtract the last number of that address. For example, if the address is 1101 0000 (0xD0), then put 110 1000 (0x68) as the slave device's address. 
  • Ensure that your slave device's address whether changed by specific connection in the board circuit. Some of the devices set to change the last number to 0 or 1 by this.
  • Check Pull-up resistor and grounding. To enable the pull-up resistor, please refer to this link. Enable NI-845x I²C Pullup Resistance

Additional Information

Each device connected to the I2C bus has a unique 7-bit I2C address to facilitate identification and communication by the master. Typically, the upper four bits are fixed and assigned to specific categories of devices (for example, 1010 is assigned to serial EEPROMs). The three lower bits are programmable through hardware address pins, allowing up to eight devices of the same type to be connected to a single I2C bus.
Each device on the bus (both master and slave) can be a receiver and/or transmitter. For example, an LCD is typically only a receiver, while an EEPROM is both a transmitter and receiver.

Sometimes when you want to enable a communication to a SMBus device with the USB-8451, the 100 kHz clock rate cannot be achieved and you get the same error message as above and it can only be solved by reducing the clock rate to 50 or 80 kHz and using suitable pull-up resistors.