Gas station without pumps

2015 August 13

Teensy LC support for PteroDAQ written but not tested

Filed under: Circuits course,Data acquisition — gasstationwithoutpumps @ 19:29
Tags: , , , ,

Adding the Teensy 3.1 board to the PteroDAQ data acquisition system only took a day of effort (see PteroDAQ supports Teensy 3.1), extending that support to the Teensy LC, took only a couple of hours, since it just meant adding another board description to boards.py and merging the KL25Z and Teensy 3.1 code that was already written.

The Teensy LC board I ordered from the PJRC store) has been shipped, but probably won’t arrive until Monday, so I’ve not been able to test the code yet.

I looked at the size of the different implementations of the firmware for PteroDAQ with the current implementations:

board bytes
Teensy 3.1 12,528
Teensy LC 12,544
FRDM KL25Z 26.6k
Arduino Leonardo 9,840
Arduino Uno 7,310

The MBED USB stack used for the FRDM KL25Z board seems to bloat the code there enormously, but even the Teensy code seems a bit bloated compared to the Arduino code (which is already much more bloated than really needed).

If the Teensy LC code works (and I see no reason it shouldn’t, after tiny amounts of debugging to remove any bugs that the compiler hasn’t already caught), I’ll probably look into using the Teensyduino setup for programming the FRDM KL25Z board also.  If I can get that to work, I’ll probably give up on the MBED toolchain entirely—their software is way too deeply layered with way too many dependencies.  It looks like it was developed by computer scientists who drank too much of the “layered abstraction” kool-aid.

The biggest problem with the Teensyduino environment for developing for the FRDM KL25Z is that they’ve not set up any of the macros for the KL25Z, which is almost (but not quite) identical to the KL26Z that they have set up.  I do have a FRDM KL26Z board, though, so maybe I should develop for that.  The difficult parts will be

  • Setting up macros that allow different compilation for FRDM KL26Z and Teensy LC, even though both are using KL26Z processors.  I can probably handle that with a new entry in the boards.txt file.
  • Setting up the download using the MBED downloader on the FRDM KL26Z board rather than the Teensy loader. I’m not sure that the Arduino environment provides any way to set up a download as “create a bin format file and write to fake flash drive”.  Even just getting the bin file created and put in an easy-to-find place may be difficult without manual intervention.

Since the Teensyduino development is supported by the sale of Teensy boards, it is unlikely that Teesyduino will ever be officially extended to support the boards sold by Freescale.

2015 August 11

PteroDAQ will support Teensy LC

Filed under: Circuits course,Data acquisition — gasstationwithoutpumps @ 07:49
Tags: , , , ,

Adding the Teensy 3.1 board to the PteroDAQ data acquisition system only took a day of effort (see PteroDAQ supports Teensy 3.1), and it looks fairly straightforward to extend that support to the Teensy LC, which at $11.65 looks like the cheapest ARM development board available.  The KL26Z chip on the Teensy LC is very similar in its capabilities to the KL25Z chip on the FRDM KL25Z boards that I’ve been using with PteroDAQ for the last couple of years, though the Teensy LC uses one with less RAM, so the boards may be more limited in handling bursts of high sampling rate.

I just ordered a Teensy LC board this morning (direct from the PJRC store) and will probably do the coding and testing for the board this weekend.  I’m now leaning towards using the Teensy LC for the class, as it will provide a lower-cost option than the FRDM KL25Z boards, especially once the cost of headers is included (we can use the Teensy LC with mostly male headers and just a couple of small female headers, which cuts about $2/board off the price of the headers).  The maximum sampling rate will be a little lower than on the Teensy 3.1, but PteroDAQ is currently more limited by the ability of the laptop to accept the data than by the board’s ability to generate it.

If I can figure out a good way to get the Teensyduino code onto a FRDM KL26Z board, I might be able to do some debugging even before the Teensy LC arrives, because I have a FRDM KL26Z board that I bought some time ago but never used.  The Teensyduino uses the GCC ARM compiler, so I think all I’ll need to do is figure out where all the compilers, linkers, and format conversion routines are kept, and all the flags that get passed to them, and I should be able to get things in the right format for the MBED download firmware on the KL26Z board.  Running the Arduino IDE with “verbose” output should provide all this information.

All the Teensy boards have their schematics online, so the pin mapping can be set up now.  I’ll have to merge some of the code we wrote for the Teensy 3.1 and for the FRDM KL25Z boards to get the rest, after checking to see what registers are different between the KL25Z and the KL26Z. All the analog-to-digital conversion and timing is being done with bare-metal manipulation of the peripheral registers, to avoid the overhead of the APIs of the MBED, Arduino, or Teensyduino systems.

I think that we may end up reusing (or modifying) the usb-serial code from the Teensy LC for the FRDM KL25Z board also, so that we can get rid of the use of MBED code.  Moving code onto and off of the MBED site is a big pain, and it would be good to have everything compilable on the laptop without needing internet access.  The MBED USB stack is about all we’re really using of the MBED code, and the Teensyduino USB stack seems to work as well (comparing Teensy 3.1 and FRDM KL25Z, which is not really a fair comparison).

2014 February 23

Soldering headers on a Freedom board

Filed under: Circuits course — gasstationwithoutpumps @ 16:14
Tags: , , ,

Because I decided to switch to the Freedom KL25Z boards this year for the circuits class, rather than Arduino boards, I have a bit of a scheduling problem.  The KL25Z boards come without headers, but the students can’t do much with them until headers have been soldered on. That means that I need to teach the students to solder on the first day of lab, rather than halfway through the course.

Because students will need instruction, I’ve tried to put together a tutorial on soldering specifically for this purpose.  Because I don’t have a KL25Z board without headers, but do have a KL26Z board (which uses identical headers), I’ve taken pictures of soldering on the headers.

There are 4 female headers to assemble—here they are shown next to the holes they need to go through.  The headers themselves should go on the component side of the board.

There are 4 female headers to assemble—here they are shown next to the holes they need to go through. The headers themselves should go on the component side of the board.

Place the headers in the holes and flip the board over onto the bench.  Sometimes it is easier to put the headers pins-up on the bench and put the board down over them.  Make sure that all the headers are flat on the bench and that the board is level on the headers.  Using 2×n headers (rather than 1×n as the Arduino boards use) makes aligning the headers easy. Make sure that the board has the feet up, so that the headers are soldered on the correct side of the board.

Place the headers in the holes and flip the board over onto the bench. Sometimes it is easier to put the headers pins-up on the bench and put the board down over them.
Make sure that all the headers are flat on the bench and that the board is level on the headers. Using 2×n headers (rather than 1×n as the Arduino boards use) makes aligning the headers easy.
Make sure that the board has the feet up, so that the headers are soldered on the correct side of the board.

To solder a pin to the board, touch both the pin and the copper ring around the hole with the soldering iron for about 3 seconds to heat both.

To solder a pin to the board, touch both the pin and the copper ring around the hole with the soldering iron for about 3 seconds to heat both.

The touch the solder to the pin and the soldering iron and hold it there until the solder melts and flows onto the pin. Remove the solder but leave the iron in contact with the pin for another second.

The touch the solder to the pin and the soldering iron and hold it there until the solder melts and flows onto the pin. Remove the solder but leave the iron in contact with the pin for another second.

I find it best to tack down each of the headers by soldering one or two pins first, so that I don’t have to worry about the headers shifting around as I solder.

After every few solder points, it is a good idea to wipe off the tip of the iron on a wet sponge, to keep the tip clean. Otherwise burnt residue of the rosin flux builds up on the iron and makes good thermal contact difficult.

I should also warn the students not to touch the rubber feet with the soldering iron. Arranging the board so that the long edge is closest to the hand holding the soldering iron (rather than the short edge as shown here) probably makes this easier. Rotating the board to solder the other side, rather than reaching across, is also a good idea.

We will be using tin-lead solder (since it is easier to work with than lead-free solders), but the lead is not a serious hazard.  A bigger problem is the smoke from heating the rosin-core flux, as the electronics lab is not as well ventilated as it should be.  I can warn the students not to breathe the smoke, and to take a 5-minute break in another room after soldering.  If we were doing a lot of soldering, we’d have to get some fans with filter units to remove the smoke from the work area.

One common problem is a "solder bridge" where too much solder was applied and two adjacent pins are shorted.  Solder bridges can be fixed in two ways: 1) sometimes just reheating the solder with the iron will cause it to reflow onto the two pads separately. 2) If there is too much solder for reflow to fix the problem, the solder can be melted with the soldering iron and sucked away with a "solder sucker", or wicked away through capillary action with "solder wick".

One common problem is a “solder bridge” where too much solder was applied and two adjacent pins are shorted.
Solder bridges can be fixed in two ways:
1) sometimes just reheating the solder with the iron will cause it to reflow onto the two pads separately.
2) If there is too much solder for reflow to fix the problem, the solder can be melted with the soldering iron and sucked away with a “solder sucker”, or wicked away through capillary action with “solder wick”.

Sometimes there is not enough solder, and bare copper or voids can be seen.  In that case, reheat the pin, and add a tiny bit more solder.

Sometimes there is not enough solder, and bare copper or voids can be seen. In that case, reheat the pin, and add a tiny bit more solder.

Pin 1 (the rightmost pin in the top row) shows another soldering flaw—there is enough solder, but it hasn't flowed onto the pad completely.  Such "cold-solder" joints can be fixed by reheating the pin and pad, without adding more solder. Some of the other pins in this picture also show cold-solder joints, though less severely.  Whenever bare copper appears on the pad, the joint needs to be reheated.  (See pin 14 to the right of pin 16, for example.)

Pin 1 (the rightmost pin in the top row) shows another soldering flaw—there is enough solder, but it hasn’t flowed onto the pad completely. Such “cold-solder” joints can be fixed by reheating the pin and pad, without adding more solder.
Some of the other pins in this picture also show cold-solder joints, though less severely. Whenever bare copper appears on the pad, the joint needs to be reheated. (See pin 14 to the right of pin 16, for example.)

I’m a little worried about students’ first soldering projects being with a $13 KL25Z board, rather than the 50¢ hysteresis-oscillator board, and needing 64 solder points, rather than 42, but I think that they can handle it. The ease of putting the board face down on the headers and tacking them all down (compared to inserting varying size and shape headers, capacitors, DIP, and resistor on the hysteresis-oscillator board) may make the KL25Z a better choice as a first solder project.

2014 February 15

Freedom KL26Z board

Filed under: Circuits course — gasstationwithoutpumps @ 14:34
Tags: ,

I bought a Freedom KL26Z board this week, because I wanted another Freedom board, and the KL26Z has somewhat nicer peripherals (added magnetometer, light sensor, I2S interface) and only costs a a couple of bucks more. It should be fairly easy to add the KL26Z to the Data Logger software, once the KL25Z board is working with it.  We may have both working in time for the Spring Applied Circuits course.

Unfortunately, the board came with the same incompetently designed bootloader (by P&E Microcomputer Systems) as the KL25Z—you can’t load programs from Mac OS X, only from Windows machines (and not Windows 8, only Windows 7). They claim that this problem was fixed last year with a newer version of the OpenSDA software, but the board I just bought from DigiKey certainly doesn’t work with Mac OS X:

Board Name is: FRDM-KL26Z
MicroBoot Kernel Version is: 1.05
Bootloader Version is: 1.09
Application Version is: 0.00

You still need a Windows machine to load the OpenSDA software, so it is not that great a “fix” (if it even works). I’ll have to make a special trip up to campus to find an ancient Windows machine. When I do that, I might put on the MBED.org download software, which was working with Mac OS X (on the KL25Z boards) months before P&E claimed to have a fix. I’m assuming that the SDA interface is the same on the KL25Z and KL26Z boards, but I’m not certain of it (mbed has different download software for the KL46Z board, which makes me concerned that there are some board-specific differences).  I could try downloading the latest P&E Microcomputer Systems software and see if it works on the KL25Z board—if not I can go back to the mbed software on that board and wait for mbed to release KL26Z software.

I’m planning to use the bare-metal ARM software development kit, with the gnu gcc compiler, for future development on the KL25Z and KL26Z boards, rather than the mbed.org development tools, because the compiled code can be much smaller (less extra junk added in).  I’ve got the code installed on my Mac, but I’ve not tried running it yet. My son, who has gotten a few small programs working with the bare-metal ARM system using the KL25Z board, was going to help me set up my Makefiles this weekend (including a loader script that removes a lot of the stdio package if you aren’t using it—the default bare-metal ARM setup includes some fairly useless “assert” statements that add many kbytes to the downloaded programs). Unfortunately, there are a lot of different viruses circulating in Santa Cruz this winter, and he’s running a fever this weekend, so we’ll probably have to delay my getting bare-metal ARM working.

 

« Previous Page

%d bloggers like this: