8-bit Knowledge Base

      • Can we use EFM8 STK on board JLink debugger to program the C8051 device?

        delu | 11/312/2017 | 08:56 PM


        Can we use EFM8 STK on board JLink debugger to program C8051 device?


        Yes, this is possible.

        The steps as follows:

        1. Upgrade the adapter firmware on the EFM8 STK to latest version 0v15p3b761. Two ways to update and verify the adapter firmware:

        a. Connect the STK to PC and start Simplicity Studio V4, Select you STK in device view. Clicking on Adapter Firmware Version->Change->Adapter Configuration, that allows you to update the Jlink adapter's firmware. You can see firmware version next to "Adapter Firmware Version" in launcher view.



        b. Start the Simplicity Commander and connect Jlink adapter of STK, under the Kit->Update Kit->Installation package, user can select fimrware package by clicking on Browse button, Then click on Install Package button to install it. The firmware version is displayed on the Kit->Kit Information->Firmware version.



        2. Connect the VTARGET, C2D, C2CK and GND signals of the Debug Connector on the EFM8 Starter Kit to the target .


        3. Make sure target MCU powered up.

        4. Change STK Debug Mode to Debug Out. Both Simplicity Studio and Simplicity Commander can do this job.

        Simplicity Commander:


        Simplicity Studio:



        5. Using Segger JLink tool to program the blinky hex image file to C8051F380 and run the code: 

        SEGGER J-Link Commander V6.17a (Compiled Jul 10 2017 17:13:16)
        DLL version V6.17a, compiled Jul 10 2017 17:12:41
        Connecting to J-Link via USB...O.K.
        Firmware: Silicon Labs J-Link OB compiled May 19 2017 10:18:02
        Hardware version: V1.00
        S/N: 440033288
        VTref = 3.250V
        Type "connect" to establish a target connection, '?' for help
        J-Link>device C8051F380
        Please specify target interface:
          C) C2 (Default)
        Specify target interface speed [kHz]. : 1000 kHz
        Device "C8051F380" selected.
        Connecting to target via C2
        DevID, DerivID: 0x28, 0xD0
        Core: CIP-51 (8051 compatible)
        Device series: C8051F38x series device
        CPU supports 4 code breakpoints
        Flash infos: 512 byte sectors, 126 sectors, all sectors unlocked
        Memory zones:
          C  CODE
          I  IDATA
          D  DDATA
          X  XDATA
          DSR  DSR
          C2  C2
        8051 (EFM8) identified.
        J-Link>loadfile F38x_Blinky.hex
        Downloading file [F38x_Blinky.hex]...


        Note: The Flash Programmer integrated in the Simplicity Studio has problem to program C8051F380 through the EFM8 STK on-board JLinker debugger. So here we choose Jlink commander tool to program C8051 devices.

        Please also check the Segger website to see what C8051Fxxx part was supported by the JLink debugger.


        Related KBA:

        How to use EFM8 Starter Kit on-board debugger to debug an external EFM8 device

        How to use EFM32 Starter Kit on-board debugger to debug an external EFM8 device

        Using the USB Debug Adapter to debug EFM8 on custom boards and EFM8 STKs



      • Do I need enable crossbar if a port pin work as general purpose GPIO

        delu | 11/312/2017 | 08:43 PM


        For 8-bit MCU like EFM8UB2, a port pin isavailable on crossbar, do I need to enable crossbar if a port pin work as general purpose GPIO (non peripheral mode)?


        For port pin is available on crossbar, if you need to control it's level through the Px.x latch value, you need to enable the crossbar.

        Take the EFM8UB2 as example, you could see what port pin was available on crossbar in figure 11.4 on page 83 of the reference manual.

        The port I/O cell block diagram shown in figure 11.2 on page 79 of reference manual.

        From the below diagram, we can know once the crossbar is disabled, the Px.x latch value wont' take effects on port pin.





      • Silicon Labs 8-bit (C8051Fxxx and EFM8) MCU GPIO type.

        delu | 11/312/2017 | 08:37 PM


        What is the difference of GPIO structure on Silicon Labs MCU families.


        5V tolerance of GPIO pins on Silicon Labs MCU families as follows

        Type A: 
        • Pins are 5V tolerant across the normal operating power supply range.   When the power supply is 0V, the pins can tolerate 3.3V indefinitely, and they can tolerate 5V for brief periods (such as a hot-plug situation) without additional pin leakage.  Long-term exposure to 5V while the chip is unpowered may result in performance degradation or failure.
        • Devices: F30x, F326.etc

        Type B:

        • Pins are tolerant of the IO power supply voltage plus 2.5V, so they are 5V tolerant with a 3.3V supply.  When the pin voltage rises more than 2V above the supply, the leakage currents from the pin to the supply and from the pin to ground will increase with voltage.  When the power supply is 0V, the applied pin voltage can be as high as 3.3V at room temperature with moderate leakage; but at that voltage, the leakage can be very high at elevated temperature.

        • Devices: EFM8UB1, C8051F86x.etc

        Type D:

        • Pins cannot exceed the IO power supply voltage, which can be up to 3.3V.  The pin includes an ESD protection diode to the power supply, so the pin leakage will increase exponentially if the pin voltage exceeds the power supply voltage by more than 0.5V at room temperature; therefore they are not 5V tolerant under any conditions.
        • Device: EFM8SB1, C8051F37x/39x.etc
      • Leakage current affects ADC measurement result

        delu | 11/312/2017 | 08:25 PM

        There is a statement in EFM8LB1 spec that pin leakage current is in the range of [-1.1 4] uA . Does this leakage current affects ADC result of external signal?

        Correct, the leakage mainly dominated by the ESD protection circuit for the port structure. It may flow in or out of the device. The leakage current is strongly sensitive to the temperature.
        Let us assume 100nA leakage, and output impedance for source signal to be measured is 10k ohm. Then the measurement error caused by the leakage likes an offset error of ADC result. This example gets 100nA*10kOhm = 1mV voltage offset (measured) on the pin.
        Under condition that ADC is configured as 2.5V VFS and 12-bit resolution. Then we have 1 LSB equals to be about 2.5V/4096 = 610uV
        Then the 10k Ohm resistance of external source signal to be measured would see 1 LSB offset error as 1mV>610uV.

        Related KBA: Comparator Input Leakage

      • Programming the CPT112S and CPT007B

        delu | 08/214/2017 | 02:26 AM


        Programming the CPT112S and CPT007B


        The device ID for CPT007B is 0x25 and the derivative ID is 0x40. The device ID for CPT112S is 0x25 and the derivative ID is 0x50.


        You could get this device information with the inspect command device8051.exe tool like below. The commander tool was located in folder like C:\SiliconLabs\SimplicityStudio\v4\developer\adapter_packs\inspect_c8051


        C:\SiliconLabs\SimplicityStudio\v4\developer\adapter_packs\inspect_c8051>device8051.exe -slist


        deviceCount = 1
        device (TS004A5562) {
          adapterLabel = ToolStick
          SerialNo = TS004A5562
          targetInterface = c2
          Name = CPT112S
          Type = MCU
          Family = 8051
          HardwareID = 0x25
          DerivativeID = 0x50
          HardwareRev = 0x2
          DerivativeRev = 0xa
          Unsupported = 0
          Indeterminate = 0
          Connected = 0
          Locked = 0

          Then you could use the  xPress configuration tool to generate the configuration hex file and flash8051.exe to program the CPT112S by below steps:


        1. Open command line here - C:\SiliconLabs\SimplicityStudio\v4\developer\adapter_packs\c8051\
        2. Make a note of the Toolstick number through Simplicity Studio, In my case, it was TS004A566A
        3. Set the desired configuration for the CPT112S board in Xpress Configurator and generate the hex file
        4. Make a note of where the hex file is located, in my case, it was C:\Users\marao\SimplicityStudio\v4_workspace\cpt112s_a01_gm\cpt112s_a01_gm.hex
        5. In the cmd line tool, enter the following command

          flash8051.exe -sn TS004A566A -tif c2 -upload cpt112s_a01_gm.hex -erasemode page

      • Convert several capsense nodes result to slider position

        delu | 08/214/2017 | 02:26 AM


        I have used the capsense library, the slider was composed of several sensors. do you have any suggestion how to convert the sensor data to slider position?


        You could refer to our example CapsenseCircleSlider for EFM8SB1 device. You could get the example code in folder like below for default installation:



        The example use centroid algorithm to interpolate the 3 nodes data to get the slider position. The bin for the 3 sensors was [20, 40, 60]. the weight 40 was for the sensor with max value captured.


        Let us assume the sensor value for the 3 sensors was x, y and z. Then 

        centroid = (x * 20 + y * 40 + z * 60) / (x + y + z)

        This would give a result with range [30 50].

        The max value 50 was getten when y equals z.

        The min result 30 was getten when y equals x.


        You should choose suitable bin parameter based on your sensor layout and target slider range.




      • Use 2.4V reference to measure the temperature for EFM8LB1

        delu | 08/214/2017 | 02:22 AM


        The EFM8LB1_TempSensor_WithCompensation example for EFM8LB1 use the internal 1.65V reference to measure the temperature, could I change the 1.65V internal reference to 2.4V internal pin reference (or other) as ADC reference voltage? 

        If the answer is yes, what factors I should take into consideration when I change the internal reference voltage for the ADC.


        Basically the answer is yes because the temperature sensor would convert the die temperature to a voltage, any voltage reference for the ADC could be used to measure the voltage converted by the temperature sensor. 


        In the example (refer to file EFM8LB1_TempSensor_WithCompensation.c) we use below formula to convert ADC code to die temperature:
        temp_scaled = ((ADC_AVG - tempsensor_0c)*SCALE) / constant;


        constant equals 28.

        tempsensor_0c was a one-point calibration value read from flash.


        The key point here is that tempsensor_0c (read from flash) and constant 28 was gotten when ADC was configured to use 1.65V voltage reference and 14-bit mode.

        In fact the constant 28 was gotten with below idea:
        For 14 bit ADC, resolution is 2^14= 16384
        temperature slope = 2.8mV/degC (Table 4.11 of datasheet)
        1.65V full range = 1650mV
        Then 2^14*2.82/1650=28.001745
        This mean when ADC was configured to use 1.65V voltage reference and 14-bit mode, 1 degC temperature change will cause 28 (decimal) ADC code change.

        The tempsensor_0c that read from flash was also gotten when ADC was configured to use 1.65V voltage reference and 14-bit mode. This means that under controlled die temperature (0 degC), use 1.65V internal reference and 14-bit mode, we get a ADC output code as tempsensor_0c.


        So if you want to change the ADC reference voltage or bit mode, you should either:

        1. scale the ADC code (get with new reference voltage and bit mode) to a code that you would get with 1.65V and 14-mode.

        2. scale tempsensor_0c and constant 28 in the formula above to suit for the new voltage reference and bit mode.

        Both should work fine.


        Let me assume you are taking the option 2 and use 2.4V reference voltage (still 14-bit mode), then you could get:

        tempsensor_0c_after = (tempsensor_0c_flash * 1650 / 2400)

        constant_after = 28 * 1650 / 2400 = 19.25


        Then the final formula to get the temperature would be:
        temp_scaled = ((ADC_AVG - tempsensor_0c_after)*SCALE) / 19.25;


        Related KBA: Why does the EFM8LB1 temperature sensor calibration use the 1.65 V internal voltage reference?

      • Some changes made on new EFM8 devices

        delu | 08/214/2017 | 02:18 AM


        I did not see VDD ramp up time requirement for some EFM8 device in the datasheet, do you made some change.

        Could you summarize some changes for these new EFM8 devices?


        The VDD ramp up time limitation was removed for EFM8UB1/EFM8LB/EFMBB1/EFMBB2 /EFMBB3/C8051F85x. But the delay time was prolonged. EFM8UB2/EFM8SB1/EFM8SB2 still need VDD ramp up to a specific level within specific time. You could see the detailed requirement in the datasheet.


        The watchdog peripheral was also changed. EFM8UB1/EFM8LB/EFMBB1/EFMBB2 /EFMBB3/C8051F85x use a separate watchdog peripheral and the initial timeout period was prolonged. You may not encounter the issue listed in this KB for these devices.


        For EFM8SB1/EFM8UB1/EFM8LB/EFMBB1/EFMBB2 /EFMBB3/C8051F85x device, DEVICEID/DERIVID was added as SFR register and firmware could access them. For old 8-bit MCU like EFM8UB2/EFM8SB2 these information could only be accessed by C2 interface.


        UUID was also added for EFM8LB1/EFM8BB2/EFM8BB3/EFM8UB1 devices. The UUID resides in the read-only area of flash memory, which cannot be erased or written by the end application. The UUID can be read by firmware or through the debug interface at flash locations 0xFFC0-0xFFCF.



      • Does Simplicity Commander support EFM8 programming

        delu | 08/214/2017 | 02:17 AM


        Does Simplicity Commander support EFM8 device programming?


        Currently the Simpliicity Commander only support programming 32-bit EFM32/EZR32/EFR32 device with SWD interface. It could not be used to program the 8-bit MCU with C2 interface.

        The standalone Simplicity Commander could be downloaded here.


        To program the EFM8 device (with J-Link) you may try the command line tool flashefm8.exe that located in the folder like C:\SiliconLabs\SimplicityStudio\v4\developer\adapter_packs\efm8

        Take the EFM8SB1 STK as example to program the on-board part you could use command:

        flashefm8.exe -sn 000440082481 -tif c2 -part efm8sb10f8g -upload EFM8SB1_Blinky.hex -erasemode page


        To program the c8051fxxx device (with UDA) you may try the command line tool flashc8051.exe that was located in the folder like C:\SiliconLabs\SimplicityStudio\v4\developer\adapter_packs\c8051

        Take the C8051F380 DK as example to program the on-board part you could use command:

        flash8051.exe -sn ec3003bb7e8 -tif c2 -part C8051F380 -upload f38x_Blinky.hex -erasemode page



      • Pin-1 identifier options for EFM8SB1 QFN24 package

        delu | 08/214/2017 | 02:15 AM


        Based on the datasheet, there are different options for pin-1 identifier, what part number should I order if I want a specific option.


        You could get 2 options (irregular corner or irregular edge) in Figure 8.1 on page 50 of the datasheet as below:



        The variability of the Pin-1 Identifier is a reality that the manufacturing flow of this product may come from multiple package vendors. Each of these vendors may implement slightly different Pin-1 Identifiers. 

        The part number could not distinguish this options. You may receive part with any option.