-
-
I found the culprit -
targetlibs/nrf5x_15/modules/nrfx/mdk/nrf.h
contains the following:/* Redefine "old" too-generic name NRF52 to NRF52832_XXAA to keep backwards compatibility. */ [#if](https://forum.espruino.com/search/?q=%23if) defined (NRF52) [#ifndef](https://forum.espruino.com/search/?q=%23ifndef) NRF52832_XXAA [#define](https://forum.espruino.com/search/?q=%23define) NRF52832_XXAA [#endif](https://forum.espruino.com/search/?q=%23endif) [#endif](https://forum.espruino.com/search/?q=%23endif)
This defines
NRF52832_XXAA
, and thus causing bothnrf52832_peripherals.h
andnrf52840_peripherals.h
to be included, and then the fun begins...After commenting this out, I am finally able to use the GPIO1 pins. @gordon do you want me to add a new SDK patch and send a PR?
-
-
So far, I learned that I can poke the GPIO register to make it work:
- Set it to output -
poke32(0x50000300+0x518, 1 << 11)
- Write 0 -
poke32(0x50000300+0x50c, 1 << 11)
- Write 1 -
poke32(0x50000300+0x508, 1 << 11)
This works and blinks the LED. Thanks for the pointer - my test program (without Espruino) is able to write to this port using
nrf_gpio_pin_write
successfully (through with SDK 15.2). I will try to narrow it down and see why it doesn't work from within Espruino. - Set it to output -
-
@Gordon would you like me to look into that and send a PR?
On a different note, it seems like I am not being able to use any pins on the GPIO1 port. I have updated the board definition file to define ports up to D48, yet when
digitalWrite
ing to D43 I have no indication from a connected LED. I have checked with another firmware, and the LED is driven by this pin correctly. Any ideas where to look for the culprit? -
Update: seems like commenting out this line solves the advertising issue. Calling
sd_ble_gap_adv_set_configure
with0
for the second parameter seems to remove all the advertising data. -
Update: it works well on nRF52840DK, but I had to follow @the1laz steps first:
cd targetlibs/nrf5x_15/ wget https://developer.nordicsemi.com/nRF5_SDK/nRF5_SDK_v15.x.x/nRF5_SDK_15.0.0_a53641a.zip unzip nRF5_SDK_15.0.0_a53641a.zip mv nRF5_SDK_15.0.0_a53641a/* . rm -rf nRF5_SDK_15.0.0_a53641a nRF5_SDK_15.0.0_a53641a.zip git apply patches/* rm -rf external/micro-ecc cp -Rp ../nrf5x_12/external/micro-ecc external/micro-ecc sed -i '/#include <nrfx\.h>/a # define NRFX_UARTE_ENABLED 0' integration/nrfx/legacy/nrf_drv_uart.h
and then compile:
make -DBOARD=NRF52840DK
The firmware seems functional, with one caveat - it won't advertise the board name nor the UART service, making it unconnectable from Espruino Web IDE. After patching the Web IDE to use the
acceptAllDevices
options I was able to connect to it from the IDE as well. -
@Gordon I don't remember too much, but I will give it another go now and update shortly!
-
Lovely! I'd love to see the updated code as well - or if you are up to it, a Pull Request will also be appreciated :)
-
@allObjects there has been some discussion regarding
async
/await
in Espruino.Right now, you can use a build-step and a transpiler such as rollup to achieve the same. It also has some other advantages that help reduce bundled code size, I used it in my In-Real-Life Chrome T-Rex Project.
You can find an example setup someone created here
-
A new experiment I have been working on, allowing to easily add remote control (over Web Bluetooth) to existing Pixl.js projects:
https://medium.com/@urish/mirroring-lcd-display-over-web-bluetooth-bb9ff2cb5d30
In action:
-
I used a Pixl.js, a NEMA-17 Stepper motor and a KY-003 Hall Effect sensor:
The Espruino source code and 3d printed parts are available on github.
You can read the full story in the blog post I just published:
https://medium.com/@urish/improvising-hardware-diy-rotary-rock-tumbler-d3a1a1915ea9
-
-
I killed my Pixl.js board after connecting accidentally 12V directly to one of the GPIO pins. That was really frustrating, as I need the board for a Trumpet Playing Robot I'm trying to build together with friends.
Before declaring the board a total-loss, I decided to try and fix it by replacing the nRF52832 chip inside the Bluetooth module. It felt like a long shot to me, but I didn't have much to lose so I tried anyway. Surprisingly, it worked and was even easier than I initially thought. I shared a blog post with all the details, many photos and even some videos of the process:
https://medium.com/@urish/back-from-the-dead-how-i-revived-a-fried-espruino-board-cf70bdb008e8
-
Okay, the hex file you built is giving me a similar result:
><- Serial1 ><- Serial1 ><- Serial1 ><- Serial1 ><- Serial1 ><- Serial1 ><- Serial1 ><- Serial1 ><- Serial1 ><- Serial1 ><- Serial1 ><- Serial1 ><- Serial1 ><- Serial1 ><- Serial1 ><- Serial1 ><- Serial1 ><- Serial1 ><- Serial1 ><- Serial1 ><- Serial1 ><- Serial1 ><- Serial1
I'm wondering why each line now has an extra
>
in front of it (there wasn't one in my version).Anyway, getting Espruino to run on it is just a nice to have experiment for me at this stage, so if you are busy, this can definitely wait...
-
-
-
It's running on the Dongle, I'll try to tinker with the pin mapping and see if that helps.
It doesn't seem the the USB serial port even show up on the Windows machine I'm connecting it to - it works in CircuitPython for the same dongle, though, so this probably has something to do with the configuration. Should I try switching to SDK 15.2.0 and see if that helps?
So far, I tried changing the pin mapping for the serial port and map RX/TX to unconnected pins, but it didn't make any difference. Also, tried switching the default console to
EV_USBSERIAL
, and now I'm getting an endless loop of<- USB
when connecting through Bluetooth. -
Since the advertisement was broken, I went ahead and patched
navigator.requestDevice
so I could still connect to the device over BLE-UART using the Espruino Web IDE:_originalRequestDevice = navigator.bluetooth.requestDevice; navigator.bluetooth.requestDevice = function(p) { delete p.filters; p.acceptAllDevices = true; return _originalRequestDevice.call(this, p); };
However, once connected, the device sends a single line endlessly, and does not seem to respond to any input:
<- Serial1 <- Serial1 <- Serial1 ...
Any ideas what this might be?
-
😍
It compiles!
When I upload the .hex file and run it on the chip, it doesn't seem to be showing up as a USB device, though it is connectable by BLE (even though it doesn't seem to advertise correctly). When I debug it in GDB, it seems to always stop inside
jswrap_regexp
routines, e.g.:(gdb) monitor reset (gdb) c Continuing. target not halted target nrf52.cpu was not halted when resume was requested ^C Program received signal SIGINT, Interrupt. matchfound (txtIt=<optimized out>, info=...) at src/jswrap_regexp.c:57 57 jsvObjectSetChild(rmatch, "input", info.sourceStr); (gdb)
Not sure if this is something wrong with my setup or it indeed is busy parsing regular expressions all the time for some reason. I will keep investigating - any pointers are appreciated!
-
Looking at .gitignore, it seems like most of the content of the
nrf5x_15
folder is not present in git. Thus, I manually downloaded SDK 15 (as well as micro-ecc, undertargetlibs/nrf5x_15/external/micro-ecc
), so now the source code compiles, however the linker script is missing:CC /home/uri/espruino/targetlibs/nrf5x_15/components/libraries/experimental_memobj/nrf_memobj.o make: *** No rule to make target '/home/uri/espruino/targetlibs/nrf5x_15/nrf5x_linkers/linker_nrf52840_ble_espruino.ld', needed by 'espruino_1v99.154_nrf52840.elf'. Stop.
Any pointers?
-
Thank you for that @Gordon! Does it still build for you?
I'm getting an error saying it can't find
nrf.h
, I suspect it could be looking in the wrong place or perhaps this file is missing in thenrf5x_15
sdk folder?uri@JAY:/home/uri/espruino$ make BOARD=NRF52840DK RELEASE=1 Generating platform configs Generating pin info Generating JS wrappers WRAPPERSOURCES = src/jswrap_array.c src/jswrap_arraybuffer.c src/jswrap_dataview.c src/jswrap_date.c src/jswrap_error.c src/jswrap_espruino.c src/jswrap_flash.c src/jswrap_functions.c src/jswrap_interactive.c src/jswrap_io.c src/jswrap_json.c src/jswrap_modules.c src/jswrap_pin.c src/jswrap_number.c src/jswrap_object.c src/jswrap_onewire.c src/jswrap_pipe.c src/jswrap_process.c src/jswrap_promise.c src/jswrap_regexp.c src/jswrap_serial.c src/jswrap_storage.c src/jswrap_spi_i2c.c src/jswrap_stream.c src/jswrap_string.c src/jswrap_waveform.c libs/math/jswrap_math.c libs/graphics/jswrap_graphics.c libs/network/jswrap_net.c libs/network/http/jswrap_http.c libs/network/js/jswrap_jsnetwork.c libs/bluetooth/jswrap_bluetooth.c libs/neopixel/jswrap_neopixel.c DEFINES = -DGIT_COMMIT=0304abbc -DNO_ASSERT -DRELEASE -DBUILDNUMBER="154" -DCONFIG_GPIO_AS_PINRESET -DBOARD_PCA10056 -DNRF_USB=1 -DUSB -DUSE_DEBUGGER -DUSE_TAB_COMPLETE -DUSE_HEATSHRINK -DUSE_MATH -DUSE_GRAPHICS -DUSE_NET -DBLUETOOTH -DUSE_NEOPIXEL -DS140 -DNRF_SD_BLE_API_VERSION=6 -D__HEAP_SIZE=0 -DBLE_STACK_SUPPORT_REQD -DSWI_DISABLE0 -DSOFTDEVICE_PRESENT -DFLOAT_ABI_HARD -DNRF52 -DNRF52840_XXAA -DNRF52840DK -DNRF52840 -DNRF5X -DNRF5X_SDK_15 -DARM -DLINK_TIME_OPTIMISATION -DEMBEDDED CC libs/compression/heatshrink/heatshrink_encoder.o CC libs/compression/heatshrink/heatshrink_decoder.o CC libs/compression/compress_heatshrink.o In file included from /mnt/c/P/espruino/src/jsutils.h:17:0, from libs/compression/compress_heatshrink.c:15: gen/platform_config.h:13:17: fatal error: nrf.h: No such file or directory [#include](https://forum.espruino.com/search/?q=%23include) "nrf.h" ^ compilation terminated. Makefile:768: recipe for target 'libs/compression/compress_heatshrink.o' failed make: *** [libs/compression/compress_heatshrink.o] Error 1
I'd also love to see faster hardware SPI in Espruino