SparkFun Electronics Commentsurn:uuid:214d0e4e-f1b1-d287-ce26-ac5b4c9f82492024-03-28T23:33:42-06:00SparkFun ElectronicsCustomer #47110 on A Disaster and a HalfCustomer #47110urn:uuid:b42ddcfb-ddb6-c8b9-3538-6c894ed0a9252019-11-15T07:16:33-07:00<p>Welcome! Sadly the BLEPeripheral lib could really use some development love and possibly a redesign to support more features of these Nordic SoCs.</p>
A sandwich by any other name would taste as sweet on A Disaster and a HalfA sandwich by any other name would taste as sweeturn:uuid:4311c2ab-596e-6993-438b-f46472ffa4c32019-11-01T15:23:47-06:00<p>Thanks for sharing your story. I love that you have monitored your house across the country.</p>
A sandwich by any other name would taste as sweet on A Disaster and a HalfA sandwich by any other name would taste as sweeturn:uuid:2666bb5c-3a87-06c2-e24a-ac54a7acb0922019-11-01T15:16:30-06:00<p>Thanks. That's a ton of good info. I suspect you just saved me a bunch of time by describing why the BLEPeripheral library is not the best. I really appreciate this comment.</p>
A sandwich by any other name would taste as sweet on A Disaster and a HalfA sandwich by any other name would taste as sweeturn:uuid:41348093-474f-f2b9-c484-51e77dd1af5a2019-11-01T15:10:32-06:00<p>I find it encouraging when others do this. I sorta wish I had finished the thing before the deadline, but since I didn't, I tried to help others with this story.</p>
Customer #47110 on A Disaster and a HalfCustomer #47110urn:uuid:0617a737-6121-7f15-4ae7-6e204da23aa72019-10-30T09:57:36-06:00<p>I have tried to do something similar with these Nordic nRF52832 chips (just we had a Chinese module instead). Here are a few observations:<ul>
<li><p>Don't waste your time with BLEPeripheral library and Arduino on these boards. Except for extremely basic things it just does not work, it requires hacks to get the right version of the Nordic "softdevice" binary blob, it works only with a very old "softdevice" version, so a lot of functionality either does not work at all or is buggy (such as bonding). The API is easy to use and most of the Bluetooth LE complexity is swept under the rug but what good is that if the device is failing randomly.</p></li>
<li><p>The Nordic SDK is excellent and has very good documentation. However, expect <em>steep</em> learning curve! The examples and documentation assume that you know how BLE works already, so it is very advisable to read up something first or you will get overwhelmed quickly. On the other hand, I have managed to get both serial port to work (BLE doesn't have "profiles", so don't look for those. There is the GATT protocol and everything works on top of that) and also a HID device (HID over GATT), persistent bonding with automatic reconnections, etc. Haven't tried to implement a central role but the SDK has examples of it.</p></li>
<li><p>Segger Embedded Studio - not worth wasting time on, IMO, unless you are working on that platform already (and are paying for it). PlatformIO or Visual Studio Code will do the same service for you, even if you are using the Nordic SDK - the SDK is very simple to integrate, you literally have to add all files from the SDK (except for the examples) to your build ... Just use the makefiles shipped with the examples as the starting point.</p></li>
<li><p>PlatformIO - the problem with PlatformIO and nRF52 series is a rather boneheaded way they have added the support. Instead of making it work with any sort of SWD debugger that works with ARM they have for whatever reason specified only certain debuggers for certain boards and that's it. It won't allow you to program or debug the device with anything else. If you have a bare bones SoC, then likely it is only CMSIS-DAP or J-Link. I didn't have neither ...
You can either flash the device from command line using OpenOCD and any SWD dongle that OpenOCD supports (PlatformIO uses OpenOCD internally anyway) or buy one of the cheap Chinese STLink clones and reflash it with CMSIS-DAP firmware (that's what I have done - after replacing the dodgy STM32F103 in it).<br>
However, you will want CMSIS-DAP or the (expensive) J-link, because many of these nRF52 series modules come with the debug port (DAP) locked down for whatever reason by the module manufacturer. So you can't even clear the flash, OpenOCD will report a weird error and refuse to talk to the chip. The only dongles with which it is possible to issue the OpenOCD DAP commands to unlock it are CMSIS-DAP and J-link. STLink will flash the board but if you can't unlock the debug port first it is of no use (but you can use it to flash/debug an already unlocked device).</p></li>
<li><p>Debugging - if you are using the softdevice (required for BLE and ANT, not needed if you are using shockburst, i.e. the protocol compatible with the older popular nRF24L01+ modules), then debugging is a pain. It is an RTOS running asynchronously and if you stop on a breakpoint anywhere, the internal timers used for scheduling events, such as sending packets on the radio, will time out and cause a crash if you attempt to resume from it.</p></li>
<li><p>Peripherals - nRF52 <em>is weird</em>. It has a ton of peripherals but most are very tailored towards BLE and the various radio-related functions (such as cryptography, checksums, etc.). The rest is both quite basic (compared to normal ARM MCUs such as NXP's or STM32s or even AVRs or PICs) and has quite unusual API. Instead of setting registers you send and react to events, almost every peripheral could be switched to almost every pin ... It is an interesting device and takes a while to grok, to say the least.</p></li>
<li><p>nRF52 is wonderful for battery life - even at full blast, busy advertising and running an ADC it draws <10mA. While sleeping the power draw is down in tens of uA ...</p></li>
</ul></p>
Customer #134773 on A Disaster and a HalfCustomer #134773urn:uuid:f17a5c61-f156-bb91-eeae-ddfaee6bbb532019-10-30T09:51:13-06:00<p>I've been doing electronics since the mid-1960s, and computers since a few weeks after Neil Armstrong took his "one small step". I've had a <em>LOT</em> of unsuccessful attempts at things since then. (Speaking of which, NASA did several unsuccessful things along the way to get man to the moon.)<p>I like to think of it as my projects "evolving". Once I decide on a goal, I'll decide on a way to get there. I'd built up a box to record indoor temperature once an hour (to a "private" web site) so I could know that the heating/air conditioning was still working and the house had power. I wanted to add some more sensors (e.g., an outside air temperature sensor), and it was clear that they'd have to have some sort of wireless link. When I started on this part, the "obvious" way was to use the (now obsolete) RFM-12B module, but my "box" was based on a Beagle Bone Black and I couldn't get the interface software to work. I eventually decided to put Arduino Pro-Minis at both ends to "talk" to the RFM-12Bs, and had gotten the Pro-Mini to talk to the BBB via I2C, and initiate the RFM-12B, but when I tried to transmit to the other RFM-12B, the near-end would lock up. After a few interruptions in working on it, I eventually eliminated the RFM-12Bs and Pro-Minis and switched to using an ESP-8266 on the far end, A few minutes ago I was able to note that the outside temperature of my home in the Phoenix area is about 10 degrees lower than what the outside temperature is here in Connecticut (the sun had just come up in AZ, so it will soon warm up and get back to "normal" of being warmer than CT).</p><p>BTW, I've found that when trying to do I2C on a new-to-me processor, first try to talk to something you've done successfully on another processor (like a temperature sensor). Also, my first venture into I2C several years ago was adding something on a second I2C port to someone else's design. Finally tracked down that the reason the second port wasn't working was because I hadn't put in the pull-up resistors. (Most of the "break-out boards" include them.)</p><p>One last point: "Mother nature" does a LOT of experimenting too -- remember that 99% of all species that have ever existed on this planet are extinct, meaning that <em>you</em> are the end product of billions of years of "trial and error".</p></p>
Customer #147145 on A Disaster and a HalfCustomer #147145urn:uuid:de4c9fd0-d085-316a-4eb2-a1e6f2eabb3b2019-10-30T07:39:02-06:00<p>Thank you so much for sharing this story. I feel we can learn so much as makers be hearing the stories of others. Especially stories that are not successful. It is rare that we share those stories, but I feel they are highly valuable to me. Thanks!</p>