-
I finally got a couple of these and found the time to look into making a board file.
#!/bin/false # This file is part of Espruino, a JavaScript interpreter for Microcontrollers # # Copyright (C) 2013 Gordon Williams <gw@pur3.co.uk> # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # # ---------------------------------------------------------------------------------------- # This file contains information for a specific board - the available pins, and where LEDs, # Buttons, and other in-built peripherals are. It is used to build documentation as well # as various source and header files for Espruino. # ---------------------------------------------------------------------------------------- ''' source ./scripts/provision.sh ALL rm bin/*.hex make clean && BOARD=XIAOBLE RELEASE=1 make uf2conv.py ./bin/*.hex -c -f 0xADA52840 mv flash.uf2 ~/Desktop/ ''' import pinutils; info = { 'name' : "Seeed Xiao BLE", 'link' : [ "https://www.seeedstudio.com/Seeed-XIAO-BLE-nRF52840-p-5201.html" ], 'default_console' : "EV_SERIAL1", 'default_console_tx' : "D6", 'default_console_rx' : "D7", 'default_console_baudrate' : "9600", 'variables' : 14000, # How many variables are allocated for Espruino to use. RAM will be overflowed if this number is too high and code won't compile. # 'bootloader' : 1, 'binary_name' : 'espruino_%v_xiaoble.hex', 'build' : { 'optimizeflags' : '-Os', 'libraries' : [ 'BLUETOOTH', # 'NET', 'GRAPHICS', # 'NFC', 'NEOPIXEL', 'JIT', ], 'makefile' : [ 'DEFINES += -DCONFIG_GPIO_AS_PINRESET', # Allow the reset pin to work 'DEFINES += -DNRF_USB=1 -DUSB', 'DEFINES += -DNEOPIXEL_SCK_PIN=33 -DNEOPIXEL_LRCK_PIN=34', # nRF52840 needs LRCK pin defined for neopixel 'DEFINES += -DBLUETOOTH_NAME_PREFIX=\'"XIAOBLE"\'', 'DEFINES += -DSPIFLASH_READ2X', # Read SPI flash at 2x speed using MISO and MOSI for IO 'DEFINES += -DESPR_UNICODE_SUPPORT=1', 'NRF_SDK15=1', ] } }; chip = { 'part' : "NRF52840", 'family' : "NRF52", 'package' : "AQFN73", 'ram' : 256, 'flash' : 1024, 'speed' : 64, 'usart' : 1, 'spi' : 1, 'i2c' : 2, 'adc' : 1, 'dac' : 0, 'saved_code' : { 'address' : ((0xf4 - 2 - 96) * 4096), # Bootloader at 0xF4000 'page_size' : 4096, 'pages' : 96, 'flash_available' : 1024 - ((0x26 + 0x20 + 2 + 96)*4) # Softdevice 140 uses 38 pages of flash, bootloader 8, FS 2, code 10. Each page is 4 kb. }, }; devices = { 'LED1' : { 'pin' : 'H0' }, # Pin negated in software 'LED2' : { 'pin' : 'H1' }, # Pin negated in software 'LED3' : { 'pin' : 'H2' }, # Pin negated in software # Pin D33 and D34 are used for clock when driving neopixels - as not specifying a pin seems to break things 'SPIFLASH' : { 'pin_cs' : 'H25', 'pin_sck' : 'H21', 'pin_mosi' : 'H20', 'pin_miso' : 'H24', 'pin_wp' : 'H22', 'pin_rst' : 'H23', 'size' : 4096*512, # 2MB 'memmap_base' : 0x60000000 # map into the address space (in software) } }; # left-right, or top-bottom order board = { }; # schematic at https://files.seeedstudio.com/wiki/XIAO-BLE/Seeed-Studio-XIAO-nRF52840-Sense-v1.1.pdf def get_pins(): pins = [ { "name":"PD0", "sortingname":"D00", "port":"D", "num":"2", "functions":{}, "csv":{} }, { "name":"PD1", "sortingname":"D01", "port":"D", "num":"3", "functions":{}, "csv":{} }, { "name":"PD2", "sortingname":"D02", "port":"D", "num":"28", "functions":{}, "csv":{} }, { "name":"PD3", "sortingname":"D03", "port":"D", "num":"29", "functions":{}, "csv":{} }, { "name":"PD4", "sortingname":"D04", "port":"D", "num":"4", "functions":{}, "csv":{} }, { "name":"PD5", "sortingname":"D05", "port":"D", "num":"5", "functions":{}, "csv":{} }, { "name":"PD6", "sortingname":"D06", "port":"D", "num":"43", "functions":{}, "csv":{} }, { "name":"PD7", "sortingname":"D07", "port":"D", "num":"44", "functions":{}, "csv":{} }, { "name":"PD8", "sortingname":"D08", "port":"D", "num":"45", "functions":{}, "csv":{} }, { "name":"PD9", "sortingname":"D09", "port":"D", "num":"46", "functions":{}, "csv":{} }, { "name":"PD10", "sortingname":"D10", "port":"D", "num":"47", "functions":{}, "csv":{} }, { "name":"PA0", "sortingname":"A00", "port":"A", "num":"2", "functions":{ "ADC1_IN0":0 }, "csv":{} }, { "name":"PA1", "sortingname":"A01", "port":"A", "num":"3", "functions":{ "ADC1_IN1":0 }, "csv":{} }, { "name":"PA2", "sortingname":"A02", "port":"A", "num":"28", "functions":{ "ADC1_IN2":0 }, "csv":{} }, { "name":"PA3", "sortingname":"A03", "port":"A", "num":"29", "functions":{ "ADC1_IN3":0 }, "csv":{} }, { "name":"PA4", "sortingname":"A04", "port":"A", "num":"4", "functions":{ "ADC1_IN4":0 }, "csv":{} }, { "name":"PA5", "sortingname":"A05", "port":"A", "num":"5", "functions":{ "ADC1_IN5":0 }, "csv":{} }, { "name":"PH0", "sortingname":"H0", "port":"H", "num":"26", "functions":{"NEGATED":0}, "csv":{} }, # LED1 { "name":"PH1", "sortingname":"H1", "port":"H", "num":"30", "functions":{"NEGATED":0}, "csv":{} }, # LED2 { "name":"PH2", "sortingname":"H2", "port":"H", "num":"6", "functions":{"NEGATED":0}, "csv":{} }, # LED3 { "name":"PH25", "sortingname":"H25", "port":"H", "num":"25", "functions":{}, "csv":{} }, { "name":"PH21", "sortingname":"H21", "port":"H", "num":"21", "functions":{}, "csv":{} }, { "name":"PH20", "sortingname":"H20", "port":"H", "num":"20", "functions":{}, "csv":{} }, { "name":"PH24", "sortingname":"H24", "port":"H", "num":"24", "functions":{}, "csv":{} }, { "name":"PH22", "sortingname":"H22", "port":"H", "num":"22", "functions":{}, "csv":{} }, { "name":"PH23", "sortingname":"H23", "port":"H", "num":"23", "functions":{}, "csv":{} }, ]; # everything is non-5v tolerant for pin in pins: pin["functions"]["3.3"]=0; return pins
not all pin assignments are implemented yet (especially on the sense version the IMU and the mic) but everything works so far. The QSPI flash is also connected although I'm not really sure how to test if the entirety of the flash is usable.
It's also compatible with the built-in adafruit bootloader, so if you use the u2conv.py script you can create a uf2 file you can just drag and drop onto the xiao ble to flash espruino on it (no need for SWD).
-
-
Interestingly some buttons seem to be more reliable than others in the remote too
Oh, I haven't actually tried all of the buttons :D (all I'm interested in were the first two since those were bound to the socket's on and off switch).
I'll try and see later if at least some of the buttons do work.
I'll also try the connection interval setting. Maybe even fanoush's suggestion of moving serial to a usb adapter might help.
-
-
I tried both "jit" and "compiled" but they both still had the FIFO_FULL message.
> ____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |____|___| _|_| |___|_|_|_|___| |_| espruino.com 2v18 (c) 2021 G.Williams > New interpreter error: FIFO_FULL >sig =function () { [native code] } > ____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |____|___| _|_| |___|_|_|_|___| |_| espruino.com 2v18 (c) 2021 G.Williams > > New interpreter error: FIFO_FULL >sig =function (e) { [JIT] }
and you're right, the count is smaller (according to my unscientific estimate) when removing "jit"
-
Here's another screencast with the count. I clicked the remote button twice: first one was before the first time I inspected
c
then the second time was after I inspectedc
then I inspected it again.Also, it looks like even when I'm not doing anything,
c
gets incremented (so I'm guessing random rf noise is triggering thesetWatch
). But when I do press the remote, it looks like the signals then get to the point that it causes the FIFO_FULL message? -
I did that too, but it still resulted in the same error message. Here's what I used, in case I made a mistake somewhere.
var n=""; function sig(e) { "jit"; // The data we have received so far // The handler that gets called when the signal changes state // start listening for a change var d = 10000*(e.time-e.lastTime); if (d<2 || d>10) { if (n.length>20) console.log(n); n=""; } else if (!e.state) n+=0|d>5; } function startListening(pin) { "jit"; setWatch(sig, pin, {repeat:true, edge:"both"}); } startListening(A0);
I'll try to see if I can do the count in a bit.
-
Sorry, I just realized you were talking about the module as in js module, not the hardware module.
I wasn't using the 433.js module because I got it to work with the rcswitch module. I don't think I had any issue with sending signals.
The FIFO_FULL message comes when using the receiver hardware module.
-
-
I'll see if I can try again later in a few hours, I should have time for it again.
It didn't print anything to the console, it shows up as soon as I press the remote.
Just in case anyone is curious, I'm trying to make one of the projects suggested there which is the fancy "sous vide" machine :p I got a janky version working with WiFi and the RPI Pico w but it wasn't really user friendly (boot up time was atrocious for some reason) so I'm porting it over to espruino and using a 433mhz socket instead.
I'll post a project writeup once I'm fully done :)
-
I'm using the same receivers as in here https://www.espruino.com/433Mhz (well they look the same at least) so I'm not sure if they have squelch.
I used the same receivers in the Arduino in order to sniff the code. I'm using this Maker Uno from Cytron that has LEDs on each of the pins, and I can see the LED glowing and changing in brightness a lot which probably means there's a lot of noise being picked up.
Then again the FIFO_FULL message only shows up when I actually push the button on the remote near the receiver.
Of course it's all academic at this point since I got what I needed but I'm still curious about what can be done to get it working :P Just for future reference :)
-
-
I managed to get the remote's binary code using an arduino lying around and the rcswitch library.
Using the same codes, I used the rcswitch module in Espruino to switch on and off the relay.
Here's what I'm using, if anyone's interested:
let _on = 0bxxxx; let _off = 0byyyy; var sw = require("RcSwitch").connect(1, D10, 10); var on = false; function toggle() { on = !on; if (on) { sw.send(_on, 24); console.log("switchOn"); } else{ sw.send(_off, 24); console.log("switchOff"); } } setInterval(toggle, 5000);
I'm still confused with the FIFO_FULL message but now that things are working (and that I know of a workaround if ever I need to do it again) it's not as big of an issue for me anymore.
I would still prefer to use Espruino for sniffing the codes though :)
-
I've tried to do a forum search but it seems that they're quite older.
I'm trying to find out the codes my remote uses for my rf socket, but when the remote is in range and I press a button, I get this error in the console.
| __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |____|___| _|_| |___|_|_|_|___| |_| espruino.com 2v18 (c) 2021 G.Williams > New interpreter error: FIFO_FULL >
I'm not really sure how to debug this. Is there a way to recompile the firmware to increase the FIFO buffer?
I'm connected via the realtek bt adapter (so i don't need to throttle send) just in case the mtu made a difference, but it's still the same.
Would moving serial from bluetooth to a serial adapter help at all?
I also just tried to send to flash, disconnect from the ide, rebooted the pixl.js and then tried the remote. I still get the FIFO_FULL message but this time on the pixl lcd so I'm guessing the serial or bt connection doesn't make a difference?
-
Also, just to round out all of the suggestions, setting throttle send to "Always" also allows me to send to Espruino as well as copy/psate code without getting disconnected (although I can subtly notice that pasting the code isn't as smooth as when using the adapter and having throttle send to auto; it's like using ssh over a slow network connection)
-
-
I tried installing the updated drivers and older drivres, but it doesn't seem to update the actual installed driver in the system (Windows will either insist that the best drivers have already been installed, or if I do manual installation by browsing and selecting the device I want to install drivers for, it will install them but the driver version remains the same even after a reboot).
-
I just tried with that bluetooth adapter (the one built-in to my thinkpad was a mediatek, this adapter shows up as a realtek) and everything works (send to Espruino button, as well as copy pasting).
This works for me right now, thanks for the suggestion :)
Not sure how else to update drivers for the mediatek one as I never had to install one in the first place (everything is managed though windows update)
-
I only have bluetooth earphones paired with this laptop (which I wasn't using when doing the tests).
I was using Edge btw (which is based on Chrome afaik)
I haven't tried removing the device from the bluetooth devices but I'll try it again next time I'm able.
I'll also try a different bluetooth adapter (I have a Feasycom one similar to that sold in the Espruino shop)
-
-
If you connect and type in the REPL, it's all fine?
yeah, if I type in the blinky example line by line it does work
What if you copy and paste a chunk of text into the REPL - say 50+ characters?
this one I'll need to confirm again, but I tried pasting the sample code on the 433 remote socket example and it disconnected. I'll be able to confirm again in a few hours (I'm out right now)
What type of computer/OS are you using?
I am indeed using Windows 11 (the BT stack on my Ubuntu 22.04 leaves much to be desired, but I can try with it again once it does work). I can also boot up a live Ubuntu image on this laptop to try things out.
I don't use any other BT device on this laptop aside from earphones, but I'll try again later with all BT disconnected aside from the pixl.
Is there a way to change the MTU for bluetooth on Windows 11? I'll also try flashing 2.08 then 2.09 and see if that is indeed the bisection point.
-
Yeah it's worked before as I've upgraded the module when I first got it, and tried out some sample programs that involve references to BTN1.
It's been years though (got it during the Bangle.js 1 kickstarter) so maybe there's been some debris underneath, or some corrosion or something.
The size of the breakout usually means I don't have to rely on that tiny button for actual user input though so it's not a big loss (aside from the janky procedure which I only really do if there's a relatively big release) :)
-
-
Update: I was able to enter DFU mode by placing a jumper between 3.3v and the left most side of the button solder joint (orientation with the module up).
I don't think I'll be able to repair or use the button anymore but at least I have a way to upgrade the firmware in the future :)
(leaving this here in case someone else has the same issue)
Update: I also just tested out EV_USBSERIAL as mentioned by fanoush above, and it works well on the Web IDE (you'll need to choose Web Serial and look for the nRF CDC serial device).
Although I really still prefer the wireless BT console :P