RedBear Duo First Impressions
Sun, Feb 21, 2016 in post Electronics arm firmware kickstarter mingw msys redbear redbear duo stat
Look what a little beauty the mailman brought! I participated the Red Bear Duo Kickstarter Campaign a while ago, and the folks at Redbear did a really professional job in delivering on the promises of that campaign.
Headline features include ARM Cortex M3 120 MHz microcontroller with plenty of RAM and flash, and of course dual WiFi and Bluetooth connectivity. Setting up the Duo was quite simple by following the instructions provided, once I realized I’ll need to use the Zadig tool as instructed in this sub-howto (Redbear guys: I think 4-5 separate pages to get one started on Windows is something that might be optimized), I got the firmware updated and everything set up. Basic outline of my installation was about this:
- Plug in the board and see LEDs light up
- Try to install the serial driver, only to realize I already had working serial (I probably have all usb serial drivers between heaven and earth installed due to encounters with various devboards)
- Connect to COM6, 9600 with Putty to verify it works as it should, note down device ID
dfu-util, and wonder why I cannot connect to the device, even with the yellow LED (looked more like yellow-green though) was blinking as it should
- Use Zadig tool to install drivers when in DFU mode
- Successfully update firmware and stuff
- Reboot the board a couple of times and connect with Putty to COM6 to see the IP address
- Visit the IP address to see the LED demo is working as it should! Nice!
Particle.io Cloud Programming
Once I had the basics figured out, I wanted to try out the Particle.io cloud development platform. It seems like an Arduino on cloud steroids, meaning that instead of flashing the device over USB cable, you write the software in a web interface, and flashing the device will upload the sketch to your device using the active wifi connection on Redbear Duo (I believe the device is periodically polling Particle.io service to see if there is a new sketch to download).
This is a rather wonderful feature, as it means I could deploy this little device anywhere which has USB power and wifi within reach, and program it remotely wherever I was. No more bringing the device next your keyboard and then hauling it back!
One strange thing happened when I tried to claim my device in Particle.io: I copy-pasted the ID from the web server output, as it seemed to match the ID given previously using Putty, when I followed the “getting started” instructions. However, I could not claim the device. Upon further inspection, the original ID contained more zeroes than the web server printout did (ID I had written down earlier was 3200350005… but web server printout had it as 3203505…). So it’s useful to follow the instructions to the letter, and not trust the later printout.
Rebuilding The Firmware
Now uploading Arduino sketches from the cloud is already pretty awesome, but was I satisfied? Of course not! I was hoping to do some low-level PWM stuff with this baby, and therefore wanted to understand better the low level stuff. Is the ARM MCU polling the cloud every now and then, or is all cloud processing happinging in the Broadcom chip? If former, there would be gaps in any signalling done by the MCU.
Unfortunately, I could not find a single source of documentation that would describe how everything works behind the scenes in Particle.io — which is quite understandable, as 95 % of users will not care, and the whole “cloud based microcontroller” thing is very new. But, I did find great set of documentation and all code (I suspect) to rebuild the firmware in the Duo from Redbear’s github page:
I had most of the prerequisites installed, but after cloning the repository and installing ARM gcc toolchain, I got into problems: The makefile was relying on
test to be available, and none of those were in my Windows MinGW/MSYS installation! Exactly the problem described here:
After about of 2 hours of trying to google where I could get
stat.exe for Windows (apart from the one I found and which lacked the necessary options), and trying to find out if MinGW Installation Manager and website really lack all search functionality (I think they do) I was getting nowhere. I finally took the brute force approach and checked the “mingw-developed-toolkit” meta package in MinGW installer, which installed about 60 new MinGW packages. But lo and behold, rebuilding the firmware now worked nicely with simply
make PLATFORM=photon in the cloned git repository root.
That’s enough hacking for today. Any good ideas for a Redbear Duo project? Chime in in the comments section!
I’m looking into these for iBeacon readers, pushing the data real time to a SQL server. Can you try out the bluetooth scanning abilities?