Avatar for LaplaceG

LaplaceG

Member since Dec 2015 • Last active Mar 2016
  • 2 conversations
  • 14 comments

Most recent activity

  • in Porting to new Devices
    Avatar for LaplaceG

    No, it was just me doing a sloppy integration the first time, with only 1 second resolution on the jshGetRTCSystemTime(). This caused it to wake up, then wait for the 1 second tick, so it could update the LEDs. The time it actually spent awake was highly dependent on the sync between the sleep-timer and the 1 second tick.

    Now that the jshGetRTCSystemTime() has sub-ms resolution it wakes up and immediately sees that it's the time to update the LEDs.

  • in Porting to new Devices
    Avatar for LaplaceG

    Yup, I do however think that we should find a way of debugging when it actually goes to deepsleep. Not sure how to do that yet, because now the terminal is only available if it doesn't go to deepsleep.

    The way I have it now is actually kind of sweet for that, because it allows me to go to deepsleep and still print stuff whenever I want (it can't accept anything though, just print). For example:

    Also, I updated the timekeeping function, and you can now see that the clock-example is operating much more energy efficiently (spending much less time awake):

  • in Porting to new Devices
    Avatar for LaplaceG

    The Energy Profiler is included in Simplicity Studio, and yes, it uses the hardware that's on all the Gecko starter kits. While originally only for Gecko devices, you can use it to profile any other device you want.

    No, the USB->Serial is just a plain UART. I think the long term solution is to move it to the in-device USB, not sure if it makes too much sense to spend time on implementing something in-between.

  • in Porting to new Devices
    Avatar for LaplaceG

    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)
  • in Porting to new Devices
    Avatar for LaplaceG

    Yup. Got it working. Just USB and analog left and we're good :)

    • 18 comments
    • 5,546 views
  • in Porting to new Devices
    Avatar for LaplaceG

    Yes, The EFM32 headers define USBand I think most parts that have USB-capabilities will define that...

    K, thanks I will try. Right now I'm struggling to get the setWatch to work correctly (without sleepdeep first). I can send a pull request and you can see if there are some obvious mistakes.

  • in Porting to new Devices
    Avatar for LaplaceG

    Thanks for the info!

    It wakes properly to tell me the time every 10 seconds, so I guess so..? Pin wake-up is not yet implemented.. I'm also having a bit of trouble testing the utility timer and Delay() functions. Do you have some simple test-cases for the framework?

    The EFM32 have USB, but it's not implemented yet :) Actually that touches another comment. If a device has USB, USB is usually defined. I would consider moving the define for the VCP to a more descriptive define, as some devices in the future will have USB but chose not to implement it.

    I actually had to change the part-number of the EFM32 to one without USB to make it compile.

  • in Porting to new Devices
    Avatar for LaplaceG

    Where is this set (jsiStatus & JSIS_ALLOW_DEEP_SLEEP)?

    I've finished implementing the deep sleep functionality so it sleeps for real if waiting for things that take more than 1/2 second but I have to comment out the above line. Of course then the console does not work very well :)

    I can't see the above flag being set for jsiStatus anywhere? Guessing that it should only be set when a console is not connected?

    Also, on another note, if I want to use 115200 baud for the console, how do I do it (on the PC side)?

Actions