Most recent activity
-
- 19 comments
- 686 views
-
Hi,
if i dopeek32(0x40000000+0x418)
i getSTATE = running
andSRC = RC
, so thats not the problem. However if i executepoke32(0x4000B000,1)
thesetInterval()
works so i assume that the RTC0 has not been started.So i made your suggested changes:
diff --git a/targets/nrf5x/jshardware.c b/targets/nrf5x/jshardware.c index 879942b..de94214 100644 --- a/targets/nrf5x/jshardware.c +++ b/targets/nrf5x/jshardware.c @@ -984,7 +987,14 @@ void jshInit() { [#else](https://forum.espruino.com/search/?q=%23else) // !BLUETOOTH // because the code in bluetooth.c will call jsh_sys_evt_handler for us // if we were using bluetooth +#ifdef SOFTDEVICE_PRESENT +#if NRF_SD_BLE_API_VERSION<5 softdevice_sys_evt_handler_set(jsh_sys_evt_handler); +#else + NRF_SDH_SOC_OBSERVER(m_soc_observer, 1, jsh_sys_evt_handler, NULL); +#endif +#endif +NRF_RTC0->TASKS_START = 1; [#endif](https://forum.espruino.com/search/?q=%23endif)
It looks like the PRESCALER configuration works like this. At least the
setInterval()
calls execute with the right interval.
For now everything works so far i think. You helped me a lot! Thanks.I've attached the complete changes. If anyone needs this too it can be found here.
-
-
Now i understand what is happening. So the lines in
https://github.com/espruino/Espruino/blob/52352efac4f8f40976a4d268a0a074ad15251b29/targets/nrf5x/jshardware.c#L984
are not needed at all, because there are no events generated.
I used your suggested changes from #9 and that works so far for writing to flash.
Thanks again for your help! -
-
Thanks for the detailed explanation!
The hex file you provided indeed does not run on the NRF52840DK. But i tried your fixes injshardware.c
and they worked. Even tho i got a linker error here (undefined reference to app_ram_base):
https://github.com/espruino/Espruino/blob/edc64ce1ab231c608110797546ffa9d445745425/src/jswrap_process.c#L159I just added defines to ignore these lines if bluetooth is disabled.
diff --git a/src/jswrap_process.c b/src/jswrap_process.c index b25720f..288fb93 100644 --- a/src/jswrap_process.c +++ b/src/jswrap_process.c @@ -156,9 +156,11 @@ JsVar *jswrap_process_env() { // Pointer to a list of predefined exports - eventually we'll get rid of the array above jsvObjectSetChildAndUnLock(obj, "EXPTR", jsvNewFromInteger((JsVarInt)(size_t)exportPtrs)); [#ifdef](https://forum.espruino.com/search/?q=%23ifdef) NRF5X + [#ifdef](https://forum.espruino.com/search/?q=%23ifdef) BUETOOTH extern uint32_t app_ram_base; if (app_ram_base) jsvObjectSetChildAndUnLock(obj, "APP_RAM_BASE", jsvNewFromInteger((JsVarInt)app_ram_base)); + [#endif](https://forum.espruino.com/search/?q=%23endif) [#endif](https://forum.espruino.com/search/?q=%23endif) [#endif](https://forum.espruino.com/search/?q=%23endif) return obj;
It compiles and runs on the NRF52840DK and is the desired result i was looking for.
I think removing Softdevice entirely would save a lot more memory but it is not needed for my application.
Thanks alot! -
-
Hi,
i have successfully compiled an Espruino 2V22 binary for the NRF52840-DK using the NRF52840DK.py board definition file.
However if i try to compile without bluetooth i get the following errors:targets/nrf5x/jshardware.c: In function 'jshInit': targets/nrf5x/jshardware.c:987:3: error: implicit declaration of function 'softdevice_sys_evt_handler_set' [-Werror=implicit-function-declaration] 987 | softdevice_sys_evt_handler_set(jsh_sys_evt_handler); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ targets/nrf5x/jshardware.c:1005:5: error: 'ret' undeclared (first use in this function) 1005 | ret = app_usbd_power_events_enable(); | ^~~
any advice on how to get espruino working on the NRF52840DK without Bluetooth?
Ahh! I don't know why this happened! So i just reversed it.