The design of synchronous reluctance motors is significantly different from brushless DC motors, so the reference design will not be useful for this application.
How can I generate a PWM waveform that has variable frequency (between 9 kHz and 12 kHz with at least 200 steps in between) using the CLU? Can I use timer 0 for this purpose? How do I control the Duty Cycle of the PWM waveform?
Answer
To start off, it is not possible to use Timer 0 reload values to vary the frequency by 200 steps between 9 kHz and 12 kHz since it is a 8-bit timer and cannot provide that level of resolution. The D flip-flop can be used to create a one-bit counter which can be output to a pin. This can in-turn be used to run the PCA through ECI. Timer 2 can be used with the CLU to generate the 9 kHz frequency pulse. The reload value of this timer can be changed to change the frequency.
The CLU can be programmed in the Configurator to generate a 9 kHz bit counter.
This setting would result in a D flip-flop as shown below -
The PCA settings should be changed to use the ECI for PWM generation
Now, the duty cycle can be altered by changing the capture compare value of the PCA channel. The only constraint is that one GPIO pin should be available (depending on the CLU output) for the PWM counter to work. The code example attached shows how CLU, PCA+ECI can be used to generate PWM signals. By adding a push button, the user can change the frequency by changing the reload value of Timer 2.
What is the minimum code size for the EFM8 capacitive sensing library (cslib)?
Answer
The minimum code size for cslib is approximately 4 kB with the UART Profiler Output disabled. The UART Profiler Output is typically only used during development and can be removed in the release build of a project. Devices with 8 kB flash are recommended for applications using cslib.
How to use EFM8LB1/EFM8BB3 I2C slave, it looks quite different from SMBus peripheral.
Answer
The EFM8LB1/BB3 contains a I2C slave peripheral, it includes many interesting features which helps on high speed transfer but may cause confusion to the user who was familiar with legacy SMBus operation. Here we make a brief intro of I2C slave, and attach an I2C slave bootloader example code for reference. This code example has been written for EFM8BB3 but can be easily ported to EFM8LB1 if needed.
The I2C peripheral contains 2 bytes FIFO and 1 byte shift register for TX/RX individually. The I2C slave support auto ACK/NACK an I2C master, it is controlled by BUSY bit field of I2C0CN0 register. In default, the BUSY is "1" which the device will not respond to an I2C master. All I2C data sent to the device will be NACKed. We should set this BUSY bit as "0", the device will acknowledge an I2C master. For a case, the master keep sending data to device, the device ACK the master automatically for max 3 ACKs since two bytes in FIFO and 1 byte in shift register. And then the SCL is hold low to indicate device is not capable to receive more data. We should check RXE bit field of I2C0FCN1 register to know if there is data in FIFO, read received data from I2C0DIN register.
The auto ACK feature makes difficulty on flow control, as we mentioned above, the SCL is hold low when the RX FIFO is full, so that device can handle the data. What about the master changes read/write direction? There is another feature can helps on this situation. The FACS bit field of I2C0ADM register. The defaults value is "1" which means FORCE_STRETCH. When this bit is set, clock stretching always occurs after an ACK of the address byte until firmware clears I2C0INT bit. With this clock stretching feature, we are able to hand the flow control during read/write direction changes.
There is an I2C slave bootloader example code which base on AN945, please take a look into it and have a reference on how the I2C slave state machine works. The I2CSlave state machine is described in two Flow Diagrams in the Reference Manual (Fig 17.7 and Fig 17.8) and can be condensed down to this Status Decoding table (Table 17.1 in the Reference Manual - https://www.silabs.com/documents/public/reference-manuals/efm8bb3-rm.pdf)
The I2C Bootloader is designed to work just like the SMBus Bootloader which is described in detail in AN945 - https://www.silabs.com/documents/public/application-notes/an945-efm8-factory-bootloader-user-guide.pdf. The boot_I2C.c file in the attachment shows how the I2CSlave peripheral is being used - one may notice that only three states are defined in the code while the Table shown above describes a lot more. There are a couple of reasons why some states are not included in the Bootloader code -
The Bootloader code is written in such a way that some of the cases described above will never occur or even if they do, they can be bundled together in a default case. We are mostly concerned with RD, WR and RD+NACK states.
The Bootloader's code is restricted by size. We try to fit it into one Flash page and that, in turn, means that we include code that is only absolutely necessary for the Bootloader to function and not account for cases that will never occur.
Why does changing the PGA setting from, say, 8 to 32 increase the current consumption of the circuit?
The PGA on a SigmaDelta ADC like the one on C8051F353 is usually implemented with CMOS switched capacitors. Essentially, there is a capacitor of a certain size that is being switched in and out at a certain frequency. This creates a variable resistor that can be scaled with frequency or capacitor size, relative to another reference capacitor in the design. The variable resistor is how we adjust the gain of the PGA.
For certain gain settings, we scale the capacitor size and the for higher gain settings (over 8x), we adjust the frequency of the switched cap. The extra supply current is probably clock current going to those switched capacitors, and some from the switches themselves, being switched at a higher frequency.
After locking code space using the lock byte, I am unable to connect to my JTAG MCU (eg C8051F020, C8051F120) using the Flash Utility or IDE. Is this the expected behavior?
Answer
For MCUs with a JTAG interface, it is not possible to connect to the device using the Flash Utility or IDE after locking the code space. To restore debug access, the device must be erased (ie "erase code space" in the Flash Utility or IDE).
For MCUs with a C2 interface, it is possible to connect to the device using the Flash Utility or IDE after locking the code space, however, the flash can not be read. Attempting to read locked flash will result in 0x00.
What does "K" mean in the C8051F120-TB-K part number?
Answer
We recently updated the legacy kit naming convention. The C8051F120-TB is the board only and the C8051F120-TB-K is the kit which includes the C8051F120-TB plus the box with the quick start card.
8-bit Knowledge Base
BLDC reference design
Can the BLDC example be applied to a synchronous reluctance motor? https://www.silabs.com/products/development-tools/mcu/8-bit/sensorless-bldc-motor-reference-design
The design of synchronous reluctance motors is significantly different from brushless DC motors, so the reference design will not be useful for this application.
Variable frequency PWM using CLU and Timers
Question
How can I generate a PWM waveform that has variable frequency (between 9 kHz and 12 kHz with at least 200 steps in between) using the CLU? Can I use timer 0 for this purpose? How do I control the Duty Cycle of the PWM waveform?
Answer
To start off, it is not possible to use Timer 0 reload values to vary the frequency by 200 steps between 9 kHz and 12 kHz since it is a 8-bit timer and cannot provide that level of resolution. The D flip-flop can be used to create a one-bit counter which can be output to a pin. This can in-turn be used to run the PCA through ECI. Timer 2 can be used with the CLU to generate the 9 kHz frequency pulse. The reload value of this timer can be changed to change the frequency.
The CLU can be programmed in the Configurator to generate a 9 kHz bit counter.
This setting would result in a D flip-flop as shown below -
The PCA settings should be changed to use the ECI for PWM generation
Now, the duty cycle can be altered by changing the capture compare value of the PCA channel. The only constraint is that one GPIO pin should be available (depending on the CLU output) for the PWM counter to work. The code example attached shows how CLU, PCA+ECI can be used to generate PWM signals. By adding a push button, the user can change the frequency by changing the reload value of Timer 2.
EFM8 Capacitive Sensing Library (cslib) Minimum Code Size
Question
What is the minimum code size for the EFM8 capacitive sensing library (cslib)?
Answer
The minimum code size for cslib is approximately 4 kB with the UART Profiler Output disabled. The UART Profiler Output is typically only used during development and can be removed in the release build of a project. Devices with 8 kB flash are recommended for applications using cslib.
How to use EFM8LB1 or EFM8BB3 I2C Slave and I2CSlave Bootloader
Question
How to use EFM8LB1/EFM8BB3 I2C slave, it looks quite different from SMBus peripheral.
Answer
The EFM8LB1/BB3 contains a I2C slave peripheral, it includes many interesting features which helps on high speed transfer but may cause confusion to the user who was familiar with legacy SMBus operation. Here we make a brief intro of I2C slave, and attach an I2C slave bootloader example code for reference. This code example has been written for EFM8BB3 but can be easily ported to EFM8LB1 if needed.
The I2C peripheral contains 2 bytes FIFO and 1 byte shift register for TX/RX individually. The I2C slave support auto ACK/NACK an I2C master, it is controlled by BUSY bit field of I2C0CN0 register. In default, the BUSY is "1" which the device will not respond to an I2C master. All I2C data sent to the device will be NACKed. We should set this BUSY bit as "0", the device will acknowledge an I2C master. For a case, the master keep sending data to device, the device ACK the master automatically for max 3 ACKs since two bytes in FIFO and 1 byte in shift register. And then the SCL is hold low to indicate device is not capable to receive more data. We should check RXE bit field of I2C0FCN1 register to know if there is data in FIFO, read received data from I2C0DIN register.
The auto ACK feature makes difficulty on flow control, as we mentioned above, the SCL is hold low when the RX FIFO is full, so that device can handle the data. What about the master changes read/write direction? There is another feature can helps on this situation. The FACS bit field of I2C0ADM register. The defaults value is "1" which means FORCE_STRETCH. When this bit is set, clock stretching always occurs after an ACK of the address byte until firmware clears I2C0INT bit. With this clock stretching feature, we are able to hand the flow control during read/write direction changes.
There is an I2C slave bootloader example code which base on AN945, please take a look into it and have a reference on how the I2C slave state machine works. The I2CSlave state machine is described in two Flow Diagrams in the Reference Manual (Fig 17.7 and Fig 17.8) and can be condensed down to this Status Decoding table (Table 17.1 in the Reference Manual - https://www.silabs.com/documents/public/reference-manuals/efm8bb3-rm.pdf)
The I2C Bootloader is designed to work just like the SMBus Bootloader which is described in detail in AN945 - https://www.silabs.com/documents/public/application-notes/an945-efm8-factory-bootloader-user-guide.pdf. The boot_I2C.c file in the attachment shows how the I2CSlave peripheral is being used - one may notice that only three states are defined in the code while the Table shown above describes a lot more. There are a couple of reasons why some states are not included in the Bootloader code -
ADC power consumption's dependence on PGA settings
Why does changing the PGA setting from, say, 8 to 32 increase the current consumption of the circuit?
The PGA on a SigmaDelta ADC like the one on C8051F353 is usually implemented with CMOS switched capacitors. Essentially, there is a capacitor of a certain size that is being switched in and out at a certain frequency. This creates a variable resistor that can be scaled with frequency or capacitor size, relative to another reference capacitor in the design. The variable resistor is how we adjust the gain of the PGA.
For certain gain settings, we scale the capacitor size and the for higher gain settings (over 8x), we adjust the frequency of the switched cap. The extra supply current is probably clock current going to those switched capacitors, and some from the switches themselves, being switched at a higher frequency.
Can not connect to JTAG MCU after locking
Question
After locking code space using the lock byte, I am unable to connect to my JTAG MCU (eg C8051F020, C8051F120) using the Flash Utility or IDE. Is this the expected behavior?
Answer
For MCUs with a JTAG interface, it is not possible to connect to the device using the Flash Utility or IDE after locking the code space. To restore debug access, the device must be erased (ie "erase code space" in the Flash Utility or IDE).
For MCUs with a C2 interface, it is possible to connect to the device using the Flash Utility or IDE after locking the code space, however, the flash can not be read. Attempting to read locked flash will result in 0x00.
Meaning of 'K' in the new C8051 target boards
Question
What does "K" mean in the C8051F120-TB-K part number?
Answer
We recently updated the legacy kit naming convention. The C8051F120-TB is the board only and the C8051F120-TB-K is the kit which includes the C8051F120-TB plus the box with the quick start card.