What is SMBus free timeout? What is the behavior of SMBus after the free timeout occurs?
The SMBus specification stipulates that if the SCL and SDA lines remain high for more that 50 µs, the bus is designated as free.
The SMBus Free Timeout detection on 8-bit MCUs can be enabled by setting the SMBFTE (or SMBnFTE) bit. When this bit is set to logic 1, the bus will be considered free if SCL and SDA remain high for more than 10 SMBus clock source periods. A clock source which is determined by the SMBus clock setting (the SMBCS bit field in SMB0CF ) is required for free timeout detection, even in a slave-only implementation.
When a Free Timeout is detected, the interface will respond as if a STOP was detected. For a matched slave address, the Free Timeout sets STO flag and generates an interrupt, the interrupt must be cleared by firmware.
If the Free Timeout condition happens after STOP detection but before servicing the STOP status flag, then STOP bit gets cleared by the Free Timeout, but the SI interrupt flag is not affected.
If the Free Timeout condition happens after STOP detection and servicing, then the STOP status flag will not be set by the Free Timeout condition.
While running the TestPanel example which included in the USBXpress 4 SDK v4.0.3 on C8051F340 MCU, the device can be enumerated as a USBXpress Device viewing from the Windows Device Manager, however, it failed to start the Host application TestPanel.exe, what would cause the issue as below?
This is caused by incorrect USBXpress driver version installed on your machine if you are not using the USBXpress driver that is included in the same SDK version.
To solve the issue, uninstall the existing driver of the USBXpress Device, and then re-install the corresponding driver included in the USBXpress SDK where you are running the USBXpress example.
For the USBXpress SDK v4.0.3 mentioned above, the driver version is 220.127.116.11 with driver date of 4/8/2013.
EFM8 Factory Bootloader AN945SW contains all EFM8 bootloader images with UART, USB or SMBus interface. The source of the efm8load tool, a python script efm8load.py is also included under /Tools/Source folder. Since Python is a cross-platform language, and therefore the script can run on a Linux system.
However, if run the efm8load.py on Linux directly, it will throw some errors because the current program in hidport.py or smbport.py does not support Linux. It is necessary to make slight modification by loading associated libraries for Linux as below on both scripts
# Load HID shared library using ctypes if sys.platform == 'win32': _DLL = ct.windll.LoadLibrary('SLABHIDDevice.dll') elif sys.platform == 'darwin': _DLL = ct.cdll.LoadLibrary('libSLABHIDDevice.dylib') elif sys.platform.startswith('linux'): _DLL = ct.cdll.LoadLibrary('./libslabhiddevice.so.1.0') else: raise RuntimeError('HidPort: Unsupported OS')
# Load HID shared library using ctypes if sys.platform == 'win32': _DLL = ct.windll.LoadLibrary("SLABHIDtoSMBus.dll") elif sys.platform == 'darwin': _DLL = ct.cdll.LoadLibrary("libSLABHIDtoSMBus.dylib") elif sys.platform.startswith('linux'): _DLL_prev = ct.CDLL("./libslabhiddevice.so.1.0", mode=ct.RTLD_GLOBAL) _DLL = ct.cdll.LoadLibrary('./libslabhidtosmbus.so.1.0') else: raise RuntimeError("HidSmbus: Unsupported OS")
These Linux libraries .so.1.0 files can be found in USBXpressHostSDK for Linux, if you have download and installed it, then you can copy-and-paste them into the same folder of the python scripts in AN945SW.
I have also updated the scripts and provided the Linux libraries in the attachment at the end of this article. With the modification above, you can run the efm8load.py on Linux successfully now. Here take EFM8LB1 STK UART bootloader as an example, the STK JLink CDC serial port appears as /dev/ttyACM0 on Linux. If using with CP210x USB-to-UART bridges, the serial port shows as /dev/ttyUSB0 instead.
To load the application image into the MCU, firstly let the EFM8 device enter UART bootloader mode, then try the following command with specified serial port:
sudo python efm8load.py -p /dev/ttyACM0 filename.efm8