EFM8 Development and Usage - Page 1
Forum section: electronics / general

author: Brianf
author_rank: Regular Contributor
timestamp: November 21, 2022, 10:50:03 am
content: This is a question(s) for people with real-world experience of EFM8s.1) Development Environment - It looks like, other than going command line assembler, it's SDCC or Simplicity Studio. What are they like to use?2) The '51 core - the '51 series was the first uC I used so I'm very familiar with the core and it's instruction set. But what's it like when wrapped inside an EFM8?3) Peripherals - what are the peripherals like? Some are obviously based on the original '51 peripherals but how about the new ones?

author: globoy
author_rank: Frequent Contributor
timestamp: November 21, 2022, 05:56:59 pm
content: I've used 3 EFM8 parts (EFM8SB1X, EFM8SB2X and EFM8BB2X) and I used SDCC with the Nordic NRF24LE1 in commercially shipping products. I used SDCC because I didn't want to shell out for the Keil compiler. TL;DR; I like the parts because they have a decent feature set at a good price (although recently subject to availability issues) for the class of problems they fit (e.g. relatively simple or low-end embedded systems).I think your questions are a little subjective but I can share my experience.QuoteI use Simplicity Studio with the Silicon Labs parts. It's ok. A big, bloated IDE like so many others but it gets the job done. The editor is reasonable. The debugger is ok (I only say ok because it has problems with things like sleep). They have some tools to help you characterize power. They have a configuration tool that can generate start-up code and even handle things like generating code to help you transition between different states (e.g. Sleep and Run, etc). Take care to really understand what it is generating though as it's pretty literal and you need to be explicit when you're trying to do things like absolutely minimize power consumption. Also you have to explicitly set the memory model in the project setup and be aware of where your variables are going since the 8051 has three different memory models, each with different performance characteristics. All my code is C. I have never had to drop into assembly for anything with the Silicon Labs parts.I really enjoyed using SDCC with the Nordic part. I had a simple makefile-based build system and used different editors (vi and bbedit on Mac) for code editing. I felt very close to the hardware (it helps that the Nordic chip is pretty simple). There are some syntactical differences with the Keil-based compiler that you need to be aware of (they do a good job documenting those). I did spend some time understanding what code the compiler would generate for optimization purposes. In the end I felt I could generate really performant code in C using SDCC although I did a few parts of some code in assembly because I needed sub-microsecond control of IO.QuoteI never used the original 8051 stuff but it looks like it's all pretty much there with additional timers, built-in extended memory and additional peripherals. I guess the modern 8051 cores are much faster, executing instructions in 1, 2 or 3 cycles mostly (so you'll want to review that probably).Documentation is pretty good. You'll be reading both the part spec for things like electrical characteristics and the reference manual for part operation (and peripheral programming/configuration). Be sure to read the errata. They seem to fix many things in subsequent revs but they do let some big bugs remain (see below for my I2C issue).QuoteI think the peripherals are typical of 8-bit devices. Mostly pretty simple register based control and controlled by code (as opposed to things like DMA engines). The additional timers have more modes. IIRC, I've used serial, I2C (master and slave), ADC, PWM, RTC, Flash programming, watchdog.The I2C slave on the EFM8SB20 is busted. It can stomp on other I2C transactions. They document (and I use) a work-around that involves using one of the timers and that seems to work but it's ugly. I've not been bit by any other hardware issues.I tend to write my own drivers for simple peripherals like these. Silicon Labs provides example code for each peripheral and maybe a library but I never found the library functions really what I wanted and it's simple enough to read the example code, the manual and write your own.Overall I've had success with these parts. I think like any family of parts there's a learning curve to climb. I have had success in re-using code between projects which has made me more productive. I've found, like a lot of developers, that once you climb that learning curve then you're more likely to use the same family for future products. So it's always worth a bit of research as you're doing to decide on what family you want to spend your time.Silicon Labs provides cheap dev boards if you want to get your feet wet. Clearly they're subsidizing these boards because they come with complex supporting circuitry including power monitoring that can work at uA and mA levels so you can profile power usage in Simplicity Studio.

author: globoy
author_rank: Frequent Contributor
timestamp: November 21, 2022, 06:01:15 pm
content: Also the EFM8 parts have this IO matrix that is used to map peripherals to GPIO and although you can directly program it, the configurator tool makes that easier (and deals with the limitations in the matrix for you so you don't have to think about them).

author: voltsandjolts
author_rank: Unknown
timestamp: November 21, 2022, 06:29:22 pm
content: From the website:FREE Keil® PK51 Developer's Kit Available for Silicon Labs' 8-bit MCUs and Studio.Silicon Labs now offers a free version of the Keil PK51 Professional Developer's Kit, including the compiler/linker/assembler for use with Silicon Labs' 8-bit microcontrollers and Studio. This free tool comes without a time or code size limit!https://pages.silabs.com/lp-keil-pk51.html

author: PCB.Wiz
author_rank: Super Contributor
timestamp: November 22, 2022, 05:37:46 am
content: Quote from: Brianf on November 21, 2022, 10:50:03 amHEX and OMF51 files can be generated by any C51 toolchain.Simplicity Studio naturally focuses on their inbuilt Keil C, as that's what SiLabs test with, but you can manually point the Debug/Download to any OMF51 fileYou can download either HEX or OMF51, but probably want to use OMF51 as that has the filenames and line numbers and symbol info.Quote from: Brianf on November 21, 2022, 10:50:03 amThe opcodes are identical, but the MHz and timings differ from classic C51.Parts like EFM8BB52 run up to 50MHz and execute pretty much at1 Sysclk per byte,providedcode runs 'in a straight line'.Jumps complicate things a bit, as does code alignment and prefetch/wait settings.If ns precision timing matters, you may want to experiment with ASM and ALIGN statements..Quote from: Brianf on November 21, 2022, 10:50:03 amMostly, they are supersets.The UART has a better BAUD design, supporting SysCLK/2/N and FIFOs

author: Brianf
author_rank: Regular Contributor
timestamp: November 22, 2022, 09:24:52 am
content: Thanks for all the replies, I'll have a good careful read.

author: westfw
author_rank: Super Contributor
timestamp: November 22, 2022, 09:43:28 am
content: Do the modern 8051s with all sorts of added peripherals manage to fit all the SFRs into the 128bytes allocated in the original 8051 architecture (that must be fun!), or do they use some sort of other scheme for accessing more registers?

author: wraper
author_rank: Unknown
timestamp: November 22, 2022, 09:58:35 am
content: Quote from: globoy on November 21, 2022, 05:56:59 pmSilabs gave free license since at least 2015 when I started using silabs MCUs.

author: Brianf
author_rank: Regular Contributor
timestamp: November 22, 2022, 04:31:20 pm
content: Quote from: westfw on November 22, 2022, 09:43:28 amIt looks like they use a paging scheme to swap in different sets of peripheral registers into the upper 128 bytes, with some registers appearing in multiple pages.

author: globoy
author_rank: Frequent Contributor
timestamp: November 22, 2022, 05:37:41 pm
content: Quote from: wraper on November 22, 2022, 09:58:35 amI must not have been clear enough. This was years ago when I wanted to program the Nordic chip. They didn't give away the Keil compiler for free. The silicon labs parts have a free compiler (as I've been using it for years...)

author: PCB.Wiz
author_rank: Super Contributor
timestamp: November 22, 2022, 07:40:02 pm
content: Quote from: westfw on November 22, 2022, 09:43:28 amGood point.SiLabs use SFR paging, but they do have an option where the interrupts select the right page for that interrupts peripherals.'Wrong page' bugs are common.