Friday, December 18, 2009


I'm at home this morning. I tried using xUnit on my PC here and also ran into problems; it looks like xUnit is generating an "unable to load assembly" error. Sigh. I'll have to track that down. It might be easier just to create a console app and run that instead, though. I really miss not having a working test framework.

I did lots of clean-up yesterday, going through almost all the unread items in my inbox. Wow. That was really nice. I reviewed several SECON papers and was disappointed by the low quality.

Before I wrote Microcontrollers: From Assembly Language to C Using the PIC24 Family, I considered adopting an ARM instead of the PIC24. The main problem was the lack of prototype-friendly packing (all the parts were surface mount), but otherwise I really liked the parts. I ran across a nice ARM part again that I'm excited about, a family from ST, the STM32F series:
  • It's based on an ARM Cortex-M3. I'd prefer an ARM Cortex-R4, since that has an optional FPU. While some companies have licensed it, I can't find any products from them yet.
  • They have a small package (36 pins, QFN, 6mm x 6mm = 236 mils x 236 mils). Note that a standard DIP is 300 mils wide.
  • Their best part in that package, the STM32F103T8, features a 72 MHz clock, 20 KB RAM, 64 KB flash, 2 UARTs, 4 timers, 10 channels sampled by two 12-bit 1 MSPS ADCs, 26 GPIOs, and one each of SPI, I2C, USB, CAN, PWM timer. The datasheet gives part-specific features, while the reference manual gives info common to all the STM32 parts. The programming manual discusses the core and its instruction set.
  • They have what looks like an excellent standard peripheral library, which looks equivalent to the library I co-wrote for the PIC. It's well-documented and looks fairly useful. It comes with example code for every peripheral and seems to include clock config and everything!
  • Their programmer/debugger, the ST-LINK, is $24. Wow. I like that. The user manual gives more details.
  • They have a bootloader with dlls to link to plus a GUI; I haven't tried it, though.
  • The errata list looks reasonable, a contrast to PIC24 errata.
The biggest cons:
  • No DIP package. Doing a quick search, there's an adapter board out there, thought it's fatter than I'd like (600 mils). Here's another option. It would mean having someone build these boards; I bet SparkFun would do it for us.
  • It's soooo painful to get another micro up and running. It's even more painful to turn this into a class. Writing another book adds another level of pain.
  • There's no reason to do this. The PIC24 is fine for what I'm doing, even in the foreseeable future. I don't see any new things an ARM would enable me to do in terms of research.
Some getting started notes:
  • Bootloading:
    • To enter the system bootloader,  set BOOT[1:0] = 01. However, the STM32F103T8 has only a BOOT0 pin in the 48 and 36 pins packages.  It looks like BOOT1 is shared with PB2 per the pinout in the datasheet (page 27). I could do this via the FTDI cable with a weak pull-up on PB2 and RTS connected to BOOT0 (see e.g. page 14 of AN2586).
    • Per AN2606 page 6, the built-in bootloader runs off the internal oscillator at 24 MHz. It uses PA10 and RX and PA9 as TX and operates at 8 data bits, even parity, 1 stop bit. Per page 8, it uses autobaud and works from 1200 to 115200 baud. It's possible that higher rates would work, though.
  • AN2586 is a hardware getting started guide.
    • The NRST (low-true reset) has a built-in pullup, per page 10; all that's needed is a pushbutton!
    • Per page 52 of the datasheet, the internal clock is accurate to +/-2% at 0-70 degrees C.
    • There are 5 pins for program/debug; however, user software can take control of them as code executes, disabling debug abilities. However, the standard connector is a 20-pin beast, only 5 pins of which must be used. There's a 2-pin mode, which would be nice. I'm still not sure how these work.
    • From the clock tree (page 78 of the reference manual), it looks like picking the internal 8 MHz source / 2, then using an x18 on the PLL gives 72 MHz for full-speed operation.
    • An odd thing: since the bootloader is permanently burned in the part, I don't need a programmer; I'd only want that for debugging support. That's nice.
    I found a neat trick: to create outlines of text for laser cutting, Word plus Visio works: create WordArt in Word (Insert tab, click WordArt). After creating it, click on the shape, select the WordArt tab, then choose Shape Outline, Width, Weight of 0, color red, no fill. I can't figure out how to set the proportions correctly, though.

    Now back to work. Forms to fill, e-mail to answer...

    No comments:

    Post a Comment