• Thought I'd do a quick write-up on how to get Espruino up running on the EFM32:

    So, after a couple of nights I got the basic support running. It supports timekeeping in EM2, wake-ups from EM2 and basic flashing and communication. If you want to try it out, download the attached binary and flash it on your Giant Gecko starter kit. Then open the web IDE and connect to the COM-port of the kit.

    If you want some simple examples, you can for example try:

    var state=0;
    
    function led_swap() {
      state = !state;
      LED1.write(state);
    }
    
    setWatch(led_swap, BTN1, {edge:'falling',repeat:true});
    setDeepSleep(true);
    

    Or:

    var Clock = require("clock").Clock;
    var clk = new Clock(2016,0,27,17,0,0,0);
    
    function setLed() {
      LED1.write(clk.getDate().getSeconds() & 0x1);
      LED2.write(clk.getDate().getSeconds() & 0x2);
    }
    
    setInterval(setLed,1000);
    setDeepSleep(true);
    

    If you ever save something to flash (using save()) or send it to EM2 and want to recover the console, just hold down BTN1 (marked as PB0 on the kit) when resetting. There's also a bug that caused the console not to recover after loading from or saving to flash.

    Here's two Energy Profiler shots of the examples above:
    Example 1, You can see it's using about 2.8 uA when waiting for pin-wakeup and the LED consuming ~0.5mA. You can also see that it actually triggers on both edges (rising & falling) with Espruino validating the trigger.

    Example 2:
    Again, you can see normal timekeeping at 2.8 uA, and the LEDs consuming 0.5 mA each..

    If you want to save something with setDeepSleep() I recommend using the below stub to go to deep sleep after 5 secs, so you have enough time to type save() after uploading the code:

    //Go to deep sleep after 5 secs, so we have time to do save()
    setTimeout(function() {setDeepSleep(true)}, 5000);
    

    Lastly, if you want to contribute just get the code from github, there is a Simplicity Studio project located in the targets/efm32 folder. What's currently missing:

    • PWM
    • SPI
    • Analog functionality
    • Serial over USB (Right now it's using the serial over the debug USB-cable. Should move this to the on-chip USB)

    1 Attachment

About

Avatar for LaplaceG @LaplaceG started