Silabs EFM8 a low cost microcontroller based on 8051 core

EFM8 chip
EFM8 chip

If you my blog and the lesson section you may notice my interest for 80×51 micro-controller family. Silicon Labs has recently launch a new 8b family based on this core.

With price less than 1 euros, they are interesting candidates for low cost hacking and hardware design. Even the programming cable is not really expensive ( $35 + port + Tax ) and the development environment is free.

EFM8 provides a 50MHz core with all the usual I/O – Serial, I2C, SPI. Plus 12 bit ADC, voltage regulator, oscillator…

The EFM8 family have 3 different members :

  • EFM8 Busy Bee : standard version, operating up to 50Mhz / 1-2 UART
    • Exist in 2/4/8/16 Kb of Flash
    • Have 256B / 512B / 2958B of RAM
    • Exist in 25MHz or 50Mhz
  • EFM8 Sleepy Bee : low energy, operating at 25Mhz  / 1-2 UART / RTC
    • Exist in 2/4/8/16/32/64 Kb of Flash
    • Have 256B / 512B / 4096B of RAM
  • EFM8 USB Capable : includes USB peripherical module, operating at 50Mhz
    • Exist in 8/16 Kb of Flash
    • Have 225KB of RAM

All of them can be programmed using the simplicity studio software available for windows, linux and mac osX (the last two are still in beta). I’ll start testing the mac Os X environment.

The environment if free to use up to 2Kb of binary size. The compiler is under Keil licences to activate it fully you need to request a licence. This is free.

Getting start with EFM8 dev environment on MAC

The software can be downloaded from this page.

Once install, the software will try to detect the target device ; this is working well if your connection fits the one described in the “make your schematics ready for being programmed” (see below)   You can type your device model, then the software is downloading the necessary environment files.

You have a dashboard with different options :

simplicityIDE1The first one is the access to the eclipse IDE to create / develop your project.

The third one is the Configurator : this tools helps to create the initialization code for all your device. This is a graphical solution to make the configuration. It seems easy to use but there is a lot of dependency between the modules. As an exemple when you want to setup an UART, you also have to activate the timer and configure it in the right mode and set the right timer frequency in a sub tab to get the right baud rate. I think we could had a simpler solution : if I select UART @ 9600bps, it could configure all the related stuff automatically. That said, the tools is nice, so it is good to have it. This tool is an eclipse perspective so once you have made the config, you can go to the source code directly.

At any time, to return to the main dashboard, you can click on the icon below :

Simplicity perspective navigation

The icon on the right side goes directly to the initial dashboard.

The generated program have two files :

  • initDevice.c : it contains all the init from the configurator
  • project_main.c : it contains all your code to customize and call the iniDevice procedures.

Hello World

Now, let’s make an hello world program.

Eventually you can configure your hardware but the default is all the IO are Open Drain digital I/O.

So we just need to edit xxxx_main.c and add a couple of lines :

SI_SBIT(LED0, SFR_P0, 6);                  // P0.6 LED0

This line defines a LED0 function corresponding to P0.6. Now we can use it :

int main (void)
{
  unsigned int i;
  // Call hardware initialization routine
  enter_DefaultMode_from_RESET();
  while (1)  {
    LED0 = 1;
    i = 0; while ( i < 60000 ) i++;
    LED0 = 0;
    i = 0; while ( i < 60000 ) i++;
    // $[Generated Run-time code]
    // [Generated Run-time code]
  }                             
}

Now you can compile and flash

complie - flash icons

Compile with the hammer icon ; debug with the bug icon ; flash with the chip icon.

That’s it !

Makes your schematics ready for being programmed

The documentation of the USB adapter is here ; be careful, the documentation is not really clear on what are the pin to use for the C2 interface : the pin are C2D (pin4), C2CK (pin7) with a 10K pull up and GND (pin 2,3,9)

Pin 10 is delivering USB VCC (5V) regulation is needed to match the component voltage.

It looks like this

Interface to connect an EFM8BB SOIC 16 to debug port
Interface to connect an EFM8BB SOIC 16 to debug port

 

 

This entry was posted in Hardware and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.