Tuesday, November 26, 2019

Building Bluetooth Mesh example for nRF52840 Dongle on a Mac

Continuing my story of getting started developing for the nRF52840 on my Mac.

I'm trying to follow instructions here, but they don't cover the Mac specifically, just Linux and Windows and say "The steps should be similar for other platforms". Disappointing.

First attempt at generating build files with cmake used (in the newly manually created build directory under the mesh SDK):


cmake -DTOOLCHAIN=gccarmemb -DPLATFORM=nrf52840_xxAA -DSDK_ROOT= ..

It worked, but generated files for the 10056 board instead of the 10059 board which is the dongle. Unfortunately there doesn't seem to be a board file for the 10059 board in the mesh SDK directory CMake/board

I copied the pca10056.board file there to pca10059.board, replacing the strings 10056 to 10059 in it. I also edited the nrf52840 section of the CMake/Board.cmake file to be:


elseif (PLATFORM STREQUAL "nrf52840_xxAA")
    set(BOARD "pca10056" CACHE STRING "Board to build examples for.")
    set_property(CACHE BOARD PROPERTY STRINGS "pca10056" "pca10059")

and then reran cmake thus (in the newly created build directory):


cmake -DTOOLCHAIN=gccarmemb -DPLATFORM=nrf52840_xxAA -DSDK_ROOT=/SDK16 -DBOARD=pca10059 ..

Looks good. It says it's using SDK15 even though I gave it the path to SDK16, but I'll try it this way.

I then run make in the build directory.

I get errors related to LED_START and LED_STOP.  Seems board related.

See my posting on the Nordic forum about this with a fix.

I got further in the compilation, now got an issue about missing symbols.
I added the path to nrfjprog and mergehex to my path, and reran cmake. Note that you need to add the subdirectories for nrfjprog and mergehex separately.

I still get a warning during build:

warning: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: warning for library: librtt_nrf52840_xxAA.a the table of contents is empty (no object file members in the library define global symbols)

and then later errors starting with:
/usr/local/gcc-arm-none-eabi-9-2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: CMakeFiles/beaconing_nrf52840_xxAA_s140_6.1.1.dir/__/__/mesh/prov/src/prov_utils.c.obj: in function `prov_utils_keys_generate':/<...>/mesh_3.2.0/mesh/prov/src/prov_utils.c:230: undefined reference to `uECC_secp256r1'
and later also complaining about missing
/<...>/mesh_3.2.0/mesh/core/src/log.c:63: undefined reference to `SEGGER_RTT_printf'
I believe I need to link with $(SDK_ROOT)/external/nrf_cc310_bl/lib/cortex-m4/hard-float/libnrf_cc310_bl_0.9.12.a
(found this out from examples/crypto/nrf_cc310_bl/pca10056/blank/armgcc/Makefile)

The mesh SDK also built build/external/micro-ecc/libuECC_nrf52840_xxAA.a
...and it's on the build line. Don't know why it isn't working. Ask Nordic?

The trick was to surround the linked archives for uECC and RTT with 
-Wl,--whole-archive and -Wl,--no-whole-archive



Friday, November 22, 2019

Nordic SDK16, nrRF52840 Dongle and gcc on a Mac

I just got some nRF52840 dongles that I ordered (for about €9 each).

This is a log of my first step of building and programming the 'Blinky' app to it on a Mac, using gcc rather than the Segger Embedded Studio.

I downloaded Nordic's latest nRF5 SDK (version 16) from here.

Downloaded the latest gcc toolchain from ARM from ARM.

Uncompressed the archive.

Copied resulting directory to /usr/local:

cp -a gcc-arm-none-eabi-9-2019-q4-major /usr/local
In the SDK (SDK16) directory, under components/toolchain/gcc: Backed up Makefile.posix, edited it to read:
GNU_INSTALL_ROOT ?= /usr/local/gcc-arm-none-eabi-9-2019-q4-major/bin/GNU_VERSION ?= 9.2.1GNU_PREFIX ?= arm-none-eabi
Go to the SDK, directory examples/peripheral/blinky/pca10059/mbr/armgcc

The makefile is already adapted to the board, so we don't need to follow the instructions here regarding setting flash start etc.

Run make. It worked! To upload the files to the board:
  • Start the nRF for Desktop app, 
  • Start the programming mode within it, 
  • select the device in the drop down, 
  • drag the .hex file from the _build directory that make generated to the nRF Connect app
  • Click 'write'
I think it works! 

The on board LED changes color red / green / white blue-green / blue / black. 

Next step: get a Bluetooth Mesh example app running.



Sunday, February 26, 2017

Building xpilot classic on Ubunut 15.04

sudo apt-get install libx11-dev xutils-dev libxext-dev

Download xpilot classic from SourceForge, Unpack.

xmkmf -a
make

I got:
Error in textinterface.c: getline conflicts with builtin
Replace all occurences of 'getline' with 'getline2' in src/client/textinterface.c

Then make. Works!

Friday, July 31, 2015

Experimenting with PLA

I'm experimenting with PLA filament on my Printrbot Classic 3D printer. Slicing with Slic3r 1.2.9. Printing with Octoprint.

Filament is not sticking to bed. The model is large but small surface area - basically a third of the perimeter of a circle with radius 100 mm, perimeter is 2 mm wide. I also have a new fan assembly which is not perfect.

Bed measured temp is around 71. Hotend temp set to 215.

Set first layer speed changed from 25% to 15 mm/s. Retry.

I think head was too far from bed. Changed G92 Z-1.6 to G92 Z-1.5 in printer init script.

filament is coming out of printhead unevenly - in globs.

Removing fan assembly. Reducing printhead temp to 210 to try to reduce uneven PLA flow. Changed G92 Z-1.5 to G92 Z-1.45. Reducing max print speed from 120 to 80 mm/s.

First layer still not sticking properly. Still uneven flow.

Lower printhead even more, to Z-1.35. Globbing could be because not sticking properly?

Still not good. Unsure if the G92 Z stuff is having an effect. Perhaps I should go out and buy blue painters' tape or hair spray.

Changed to G92 Z-1.1. Still looks the same.

Now tried adjusting Z-stop screw instead of G92. Removing G92 command. Retry.

That seems to have done it!

Continued experiments:

Added a spoke to the model. Changing first layer speed from 15 to 20 mm/s. Changing max speed from 80 to 100. Calculate volumetric speed equivalent of 100 mm/s: cylinder 2.85 mm diameter x 100 mm volume = 638 mm^3 / s. Test with 638. Increasing layer height to 0.4 mm.

Worked fairly well. Print time 44 minutes. Extruder stepper was losing steps when printing the smaller top part. That part also turned out poorly, probably no fan caused it not to have time too cool down. For the next one, try a minimum layer time (30 second layers were good, 5 second layers were bad), slower volumetric speed, try even higher layers (0.5 mm).

Changed minimum layer time to from 5 to 30 seconds, max volumetric speed to 500, first layer speed to 20, layer height to 0.5, default extrusion width to auto. Print time will now be about 90 layers * 30 seconds = 45 minutes.

The extruder stepper is still losing steps. I don't understand why. Stepper motor weak because it is hot? trying decreasing pressure holding filament against knurled bolt in extruder. I think reducing this pressure fixed the problem.

Note to self: next time, thread the filament from the spool, through the 'b' in the pb (PrinterBot) logo on the Power Tower, so that the filament is not pulled sideways off the spool.

Worked well. Slower layer times appear to be an alternative to having a fan.

Continued experiments 2015-08-02

Made a fan attachment model in FreeCAD (fairly difficult design for me). Printing with 30% infill. Increasing layer height from 0.5 to 0.6 mm, max print speed from 100 to 120, max volumetric speed to 550, first layer speed from 20 to 25 mm/s.

Extruder skipped. Raised extruder temp to 215. Head was too far from printbed. Needed to back off on Z-screw 1.5 turns.

Got a printout. It was pretty rough, stringy. Some parts of layers didn't attach properly. Dimensions were not very accurate. Maybe 0.5 layer is just too rough. Trying to print it at 0.3 mm. Max print speed at 100, max volumetric speed 500, first layer speed to 30 mm/s.

Printout turned out fairly well. A bit of unevenness, but OK for a structural part that doesn't have to be pretty.

Changing seam position to nearest, decreasing filament temperature from 215 to 213. Increasing first layer speed to 40 mm/s, decreasing diameter from 2.85 to 2.83 to decrease extrusion. Decreasing bed temp from 42 to 40 (Note that my temp sensor is wacky, so this is not the actual temperature), don't combine infill (so little infill anyway in this model). Sent to printer, will print tomorrow.

Tuesday, July 28, 2015

Raspberry Pi troubles solved

After updating the software (using apt-get) on the Raspberry Pi I use to run OctoPrint to control my 3D printer, it would not recognize my TPLink USB WiFi dongle.

Turned out that the firmware needed for it has been removed from the Raspberry Pi kernel, so the fix as presented here was to do:

sudo wget https://github.com/lwfinger/rtl8188eu/raw/c83976d1dfb4793893158461430261562b3a5bf0/rtl8188eufw.bin  -O /lib/firmware/rtlwifi/rtl8188eufw.bin
I had some other problems too, apparently I must have powered down the RPi messily. I had to use the Mac's Disk Utilities to repair the boot partition (Windows FAT format), then load a Linux virtual machine and copy the start.elf file from another copy of the distribution to my boot partition.



Sunday, January 25, 2015

Using an Arduino 32u4 as a Visual Pinball controller

I'm building a Visual Pinball cabinet, and I'm planning to use an Arduino Compatible board (a Pololu A-Star 32U4 Micro) as a controller. The Arduino will appear as a USB keyboard, joystick and Media remote to convert button pushes to keyboard presses, plunger position to joystick movements, and volume knob rotations to volume controls on the PC.

I may later try to use the Arduino as an output device as well, to control a lit button, and some solenoids.

I've found the following sites with information:
So, all information seems to be available.

The second two links both require modifying two files (in the Arduino installation. Too bad the software is not flexible enough to support using new USB device types without modifying the distribution.

I forked the Arduino stable (1.0.6) distribution on GitHub here.

I've pushed my untested changes. To be continued.

Sunday, October 26, 2014

Adding a new disk to an LVM Ubuntu system

Today I'm adding another disk to my main Linux server.

I used cgdisk to write a partition table. I set the partition type to 8e00 for LVM (Logical Volume Manager?)

sudo pvcreate /dev/sdb1

$ sudo lvcreate --extents 100%FREE -n lvdisk2 vgdisk2 
  Logical volume "lvdisk2" created

$ sudo vgcreate vgdisk2 /dev/sdb1

  Volume group "vgdisk2" successfully created

sudo mkdir /mnt/disk2
sudo mount /dev/vgdisk2/lvdisk2 /mnt/disk2/

And it's up!