Member | Action | Date | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Posted
How to configure LESENSE Alternate Excitation in Series 1 devices on 32-bit Microcontroller (MCU) Knowledge Base
QuestionHow do I use the alternate excite pin for LESENSE excitation in series 1 devices?
AnswerThere are a total of 16 channels in the LESENSE peripheral, and there are 8 alternate excitation pins. Each alternate excite pin is mapped to Channel X and Channel X + 8 with 0 < X < 8. For pin mapping of each device, please refer to the Alternate Functionality Overview section in the device's datasheet. In order to use the alternate excitation pin, add the following sequence into the LESENSE initialization routine: 1. Set ALTEX to true in the LESENSE_CHx_INTERACT register (x being the channel number you want to configure). 2. Set ALTEXMAP to ALTEX in the LESENSE_CTRL register. 3. Enable the corresponding channel pin (CHxPEN) and Altex pin (ALTEXxPEN) in LESENSE_ROUTEPEN register. 4. Configure the LESENSE_ALTCONFIG register for desired setting (check register description in the reference manual for more information). 5. Make sure the corresponding GPIO pin for alternate excite is set to push-pull output if the excitation type is logical low or logical high. You should be able to see the excitation pulse in the alternate excite pins with these configuration added.
An example of using LESENSE excitation pin is attached in this article. The example runs on an EFR32MG12 starter kit and the excitation pulse is on PA8, which is the alternate excitation pin for LESENSE channel 0 on EFR32MG12. The code added to enable alternate excite is: LESENSE -> CTRL |= LESENSE_CTRL_ALTEXMAP_ALTEX; LESENSE -> ROUTEPEN |= LESENSE_ROUTEPEN_ALTEX0PEN | LESENSE_ROUTEPEN_CH0PEN; LESENSE -> CH[0].INTERACT |= LESENSE_CH_INTERACT_ALTEX; LESENSE -> ALTEXCONF |= LESENSE_ALTEXCONF_IDLECONF0_LOW; |
Apr 06 2020, 9:55 PM |
||||||||||||||||||||||||||||
![]() |
Posted
Metering with LESENSE on Knowledge Base
This knowledge base article demonstrates low power operation of the EFM32TG11 using LESENSE to measure movement (rotations and direction) of a half metal disc, similar to what would be used in a water or gas meter. This article includes a software project, and schematic and layout files for an expansion board that connects to the EFM32TG11 STK (SLSTK3301A). Hardware Design This example uses the SLSTK3301A starter kit for the EFM32TG11, and a custom PCB that connects to the expansion header. The board has two LC tanks, like the one on the STK, and a 3" half disc mounted to the board with RC car bearings and axles (Traxxas 5116 and Traxxas 6853X). There are also footprints to place two hall effect sensors (Si7204 or Si7210) under the disc, although theseare not implemented in this design. The two tanks on the expansion board are driven by the main output of DAC0 CH0. These two tanks, and the one on the board share the excite pin (PB11). All tanks can be sampled in this configuration. To use PB11 as LESENSE_EXCITE, a wire needs to be connected to the lower half of R198, to a 100 ohm resistor. The other end of the resistor should be connected to W14. A 0.1 uF capacitor should also be connected from W14 to ground.
Software Design Once initialized, the main tasks of the application are handled by LESENSE without software execution. LESENSE can run in EM2 while clocked from the LFXO. LESENSE implements quadrature decoding with the decoder state machine. The decoder uses PRS to send signals to PCNT, which maintains the count of rotations. The main loop handles updating the LCD display (triggered from a periodic cryotimer interrupt), and detecting button presses to cycle through display modes.
Current Consumption When scanning at 16 Hz and sampling 3 tanks, with the LCD off, the average current consumption is 3.5 uA. Enabling the LCD adds about 2 uA of current consumption to power the LCD as well as to do the calculations to generate the strings to display (sprintf).
Tamper Detection Only two tanks are required for quadrature decoding of a disc. Typically, half of the disc is made of metal and the tanks are placed 90 degrees apart. With only 90 degrees of the disc's rotation is monitored by the tanks, there is a period where the disc is not detected by either coil. Removing the disc entirely would be indistinguishable from the disc stopping in this position. This would allow unbilled use of the meter. To prevent this, a third tank can be used so that at least one tank is covered at any time. The third tank does not need to be Debugging Because most of the work this application does is handled by the LESENSE state machine, traditional debugging with breakpoints and stepping is not very effective. Components can be tested one stage at a time (LESENSE counts, scan results, decoder state, PCNT) by reading the registers, or directing the output to an IO pin (for example, PRS signals from the DECODER can be measured at IO pins to verify the DECODER is operating correctly, then the PRS signals can be sent to the PCNT module).
Conclusion This application was developed on an EFM32TG11 (Series 1). Porting to other Series 1 devices that have VDAC and LESENSE is straightforward. The firmware uses emlib for most of the configuration, ensure the availability of DAC alternate output on LESENSE pins.
See AN0029 for a more detailed explanation of LESENSE and a software example for Series 0. See the software example SLSTK3301A_helges_demo for another software example that uses LESENSE on an EFM32TG11 STK to detect metal near the onboard tank of the STK. |
Jan 03 2020, 5:47 PM |
||||||||||||||||||||||||||||
![]() |
Updated
3rd Party Pre-Programmed Devices on Knowledge Base
QuestionHow do I order pre-programmed Silicon Labs EFM32 and 8-bit MCU products? AnswerSilicon Labs and its distributors offer pre-programmed devices. Using this service is the easiest way to get your code onto the device. Once your binary is provided, the devices will be programmed in house and sent out. This method may be subject to minimum ordering quantities and is subject to a cost increase. Contact your distributor or your local Silicon Labs sales representative for more information.
|
Sep 16 2019, 5:35 PM |
||||||||||||||||||||||||||||
![]() |
Updated
to
SD card as file system and mass storage device
Hi Saiiru, I suggest taking a look at the USB MSD example we have for the EFM32GG Development Kit (DK3750), which can be found in Simplicity Studio. This example can use memory internal to the MCU or external, including an micro SD card that's on the Dev Kit. Here's the example's description for convenience:
|
Aug 22 2019, 3:59 PM |
||||||||||||||||||||||||||||
![]() |
Updated
to
SD card as file system and mass storage device
Hi Saiiru, I suggest taking a look at the USB MSD example we have for the EFM32GG Development Kit (DK3750), which can be found in Simplicity Studio. This example can use memory internal to the MCU or external, including an micro SD card that's on the Dev Kit. Here's the example description for convenience:
|
Aug 22 2019, 3:58 PM |
||||||||||||||||||||||||||||
![]() |
Replied
to
SD card as file system and mass storage device
Hi Saiiru, I suggest taking a look at the USB MSD example we have for the EFM32GG Development Kit (DK3750), which can be found in Simplicity Studio. This example can use memory internal to the MCU or external, including an micro SD card that's on the Dev Kit. Here's the example description for convenience:
|
Aug 22 2019, 3:58 PM |
||||||||||||||||||||||||||||
![]() |
Replied
to
HyperRAM with EFM32/Gecko?
Hi Brendan, Note: none of the EFM32 documentation explicitly states HyperBus is supported. Taking a quick look at the HyperBus protocol, the EFM32GG11 QSPI will not interface with a HyperBus device because the EFM32GG11 QSPI hardware does not have the following signals:
|
Aug 19 2019, 3:55 PM |
||||||||||||||||||||||||||||
![]() |
Replied
to
CP2112-EK issue
Hi Chen, The CP2112 can tolerate 5V on the GPIO pins (including SDA and SCL), but only at sufficient VIO, per the absolute max specifications in the datasheet: So, ensure the CP2112 VIO is at least 1.4V before applying 5V to SDA and SCL. Exceeding the absolute max specifications can cause permanent damage to the device. |
Aug 19 2019, 2:34 PM |
||||||||||||||||||||||||||||
![]() |
Posted
What are the rail multi timers for? on
qna
The documentation for RAIL_ConfigMultiTimer() says that it adds a software timer layer so you can have as many timers as you want, but RAIL_SetTimer() does not say there is any limit to the number of non multi timer timers you can set, so what is the purpose of the multi timers then?
|
Aug 19 2019, 2:16 PM |
||||||||||||||||||||||||||||
![]() |
Posted
Hi, I am trying to interface acclerometer and efr32mg12 board using SPI, I have written the initial config part, I am not sure of the apis that I have to use in spiriv.h and .c. is there anyway you can help me out here by shedding some light or throw some examples on
qna
SPIDRV_HandleData_t handleDataMaster; SPIDRV_Handle_t handle =&handleDataMaster; void spidrv_setup() { CMU_ClockEnable(cmuClock_HFPER,true); //enable HF peripheral clock CMU_ClockEnable(cmuClock_USART1,true); //ENABLING FOR USART1 CMU_ClockEnable(cmuClock_GPIO,true); //ENABLING FOR GPIO GPIO_PinModeSet(gpioPortA,3,gpioModePushPull,1); //enabling he chip select GPIO_PinModeSet(gpioPortA,0,gpioModePushPull,1);//MOSI GPIO_PinModeSet(gpioPortA,1,gpioModePushPull,1);//MISO GPIO_PinModeSet(gpioPortA,2,gpioModePushPull,1);//CLK
// Enabling the misc signals ///GPIO_PinModeSet(gpioPortA,4,gpioModePushPull,1); //wp //GPIO_PinModeSet(gpioPortA,5,gpioModePushPull,1); //hold#
SPIDRV_Init_t initdata =SPIDRV_MASTER_USART1; initdata.clockMode=spidrvClockMode3; initdata.bitOrder=spidrvBitOrderMsbFirst; initdata.csControl=spidrvCsControlAuto; initdata.portLocationTx=USART_ROUTELOC0_TXLOC_LOC11;//mosi initdata.portLocationRx=USART_ROUTELOC0_RXLOC_LOC11;//miso initdata.portLocationClk=USART_ROUTELOC0_CLKLOC_LOC11;//clk initdata.portLocationCs=USART_ROUTELOC0_CSLOC_LOC11;//cs USART1->ROUTEPEN = (USART_ROUTEPEN_CLKPEN) | USART_ROUTEPEN_CSPEN | USART_ROUTEPEN_TXPEN | USART_ROUTEPEN_RXPEN; //enabling //initialize spi driver instance as master here SPIDRV_Init(handle,&initdata); USART_Enable(USART1,usartEnable); |
Aug 19 2019, 2:17 PM |