Avatar for mjdietz

mjdietz

Member since Jul 2015 • Last active Sep 2016
  • 6 conversations
  • 20 comments

Most recent activity

  • in Interfacing
    Avatar for mjdietz

    Working on my port to the nRF52 and trying to get Flash to work. I want to be able to save() and load() code etc...

    I've been having some problems and now that I'm using the Flash module I can kind of debug them. When I call Flash.erasePage(0x0); Espruino basically stalls out (but when I read flash memory through nrfjprog.exe it does look like the page was actually erased). It doesnt print anything else after that and the terminal looks like it just freezes. I can't even hard reset the board after it.

    I kind of have a theory: whenever you do a flash operation with nRF5x devices the non-volatile memory controller takes control and does it for you. (you just configure it for read or write, pass it the address (and value) and then wait for it to finish). However it halts the CPU while it is doing this. Could this be causing the problem I'm seeing? Any work arounds or other ideas about the issue? I think same issue happens when I try to save() and load() code. Espruino just freezes

  • in Interfacing
    Avatar for mjdietz

    OK so I'm thinking i change my linker file so that the last couple of pages in flash are reserved for saving. So right now in my linker my flash has an ORIGIN address that is incremented so it is just after the softdevice and it has a length that then goes to the end off flash to be used by my application.

    How many pages (each page is 4096 bytes) should I reserve for Espruino at the end so I get full functionality?

    Also in BOARDS.py would address by the address of the first page to be used to save? then flash_availialbe would be the total bytes of these save pages? also what is place_text_section?

    so then jshflashcontainscode() would just check the first address of this flash to see that it has been written? any specific value or just check that it is not completly ereased?

    and are you saying I dont actually have to implemtn jshSaveToFlash and load? I'm not sure how to compress ram etc..

    thanks!
    -Mike

  • in Interfacing
    Avatar for mjdietz

    I am trying to implement some functions in jshardware.c

    I want the save() functionality so I can save functions and variables and keep them when the device turns on. and then can use the onInit() functionality as well.

    so I'm assuming to get this working I just need to implement the Flash functions in jshardware.c?

    what exactly is jshSaveToFlash and jshLoadFromFlash supposed to do? I'm not really sure where or what the contents of JsVars is.

    also how would you reccomend implementing jshFlashContainsCode()?

    -Thanks
    Mike

  • in Interfacing
    Avatar for mjdietz

    for example:
    1.) turn on board loaded with espruino_nrf52.hex, board starts advertising in jshinit().
    2.) connect to board with smartphone
    3.) send "digitalWrite(LED_1, 1);" using UART simulated over BLE
    4.) LED_1 lights up.

    then extend this to sending entire scripts. (currently using nordics nRF Toolbox app and the UART module to send and receive data from espruino).

    --My problem

    currently this is kind of working.. i can send commands under 20 bytes no problem. but when i send a command like "function a() { 25; }" the chip hard fualts. also for some reason i cant send over ~36 bytes even though i implemented ble long write and not sure why...

    I am pretending like I am using EV_SERIAL1 right now. just using pushIOCharEvent like normal and USARTkick.

    just looking for some advice on how to make this work. any suggestions/tips? Maybe i have some misunderstanding about how espruino read and writes from the terminal and what it expects? any suggestions on source files that I should look at to get a better idea about this?

    thanks,
    Mike

    • 10 comments
    • 1,589 views
  • in Interfacing
    Avatar for mjdietz

    Going to make a pull request today. Also working on BLE support now but should have more details in pull request. Thanks for all the help so far!

    -Mike

  • in Interfacing
    Avatar for mjdietz

    OK, found the problem. Some makefile/linkerscript problems. Got the bare bones working today though! Able to blink an LED from the chrome ide :)

Actions