Is there any sort of blink example project already configured with a Makefile that builds a DFU image for the Puck.js?
I don't really have a need for the additional sensors that the puck includes, I only have a need for NFC related functions at the moment.
I'm no stranger to Linux either.
If you have some functionality that is not supported by the espruino Js -> C compiler, you can add your own C code: https://github.com/espruino/Espruino/blob/master/libs/README.md
If you want to do 100% custom code, Nordic semi's website is your best bet I guess: https://www.nordicsemi.com/Products/Low-power-short-range-wireless/nRF52832
between first and second choice there is also https://www.espruino.com/InlineC
can do more than compiled JS (and faster, with less bloat) but less than native extensions linked into Espruino binary
I'd rather just write the code in native C instead of dealing with anything the JS to C transpiler might introduce.
I don't have an issue with C code, I'm just a little confused with how the compile process works, especially when you consider that the puck.js has secure dfu
My code when you really boil it down can be condensed into a single switch statement on the first byte of the received data since all NFC commands are one byte
So you don't need bluetooth either? what you do with bytes received over nfc then?
How do you plan to debug it or update after your code hangs due to some bug?
Anyway, you can start with
nrf2832 specs https://infocenter.nordicsemi.com/topic/struct_nrf52/struct/nrf52832.html?cp=4_2 and Nordic SDK12 https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v12.3.0/index.html?cp=7_5_9
If you plan to use SWD you can use any other (e.g. latest) SDK
I don't actually need bluetooth at this very moment, what I'm doing is writing a NTAG215 tag emulator that has a couple different slots that can be swapped with the button that also has a backdoor NFC command that allows rewriting the entire "tag".
As far as debugging, I have pin headers on my puck and just connect over uart.
here's what I have so far, it does work, but not all devices are very accepting of the timings.
Hi - the issue you might be having is (as you say) the delay introduced by Espruino's JS handling of NFC. Hopefully you could write some Inline C code, but Espruino still executes that code outside the interrupt in which it happens, which would introduce some lag.
As others have said, the Puck is just a standard nRF52832 using SDK12. You could get Nordic's tools set up and then just start compiling and uploading their NFC examples and they should 'just work': https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v12.3.0%2Findex.html&cp=7_5_9
However you'll probably find that a very steep learning curve. We've had to patch Nordic's NFC libraries to let us get that low level with tag handling.
So there is a bit of a middle ground - just compile the Espruino firmware and make some tweaks to it. If you've some knowledge of Linux it should be totally trivial: https://github.com/espruino/Espruino/blob/master/README_Building.md#under-linux
Then you can add your code into the NFC handler here: https://github.com/espruino/Espruino/blob/master/targets/nrf5x/bluetooth.c#L1525
At that point (nfc_callback) you're running in an IRQ, so anything you do should be extremely fast.
Don't worry about formatting, just type in the text and we'll take care of making sense of it. We will auto-convert links, and if you put asterisks around words we will make them bold.
For a full reference visit the Markdown syntax.
© Espruino, powered by microcosm.
Report a problem