Monday, October 21, 2013

Cheap Arm Programmer

DSC_9764
So you have a custom ARM Cortex-m0 (or other) board you want to program. Perhaps, like me, it’s a custom board using Nordic Semiconductors nRF51422/822/922. You may have bought an Evaluation Kit with a built in J-Link debugger. However, once you move to a custom board you now face the problem of programming it.
I bought both the nRF51422-EK and nRF51422-DK. Each kit was $100 USD. The EK did what I wanted, the DK “requires” the nRFgo development kit which is $400 dollars. What you might not know is that this board provides only power and the nRF51422-DK comes with a Segger J-Link lite. The J-link Lite is what I’ve been using to program my custom boards. I think $100 dollars for a programmer is ridiculous. My AVR was $50 dollars and that allows me to do everything.
Enter CMSIS-DAP. It seems this is intended to add debug functionality and firmware updating to embedded applications but looks like you can use it as a standalone programmer without any restrictions (like with the J-Link EDU; Cost effective but limited to Educational).
So pick yourself up a $14 Freescale Freedom FRDM-KL25Z. Cheaper than an Arduino and way more powerful with a 3 axis accelerometer, a tri colour LED and a capacitive sensor. It has two microcontrollers – the main one and a little one running OpenSDA. With OpenSDA you can load up a CMSIS-DAP firmware from Freescale and program other boards. Credit to www.mcuoneclipse.com for the idea

Here is how:
  1. Cut J11 Trace. This disables programming the main KL25Z microcontroller.DSC_9767
  2. Install a 1mm pitch, 10 Pin header at J6. Little bit difficult to solder due to the fine pitch.DSC_9766
  3. Break Pin 7 off – This is the Key pin. This isn’t needed if you don’t have a blocked pin on your ribbon cable. DSC_9770
  4. Hold RST while plugging it in. This loads it into OpenSDA firmware upload mode.DSC_9768
  5. See a new drive image
  6. Download Freescale Quickstart here and copy CMSIS-DAP_OpenSDA.S19 to the Bootloaderimage
  7. Unplug and plug back in. Now Freescale is in CMSIS-DAP mode.
  8. Connect your custom board DSC_9763
  9. Set to CMSIS-DAP (I’m using Keil) image
  10. Switch to SW programming and not JTAG image
And now you can program. The one caveat is that it won’t autoreset my board. I have to disconnect.
There are other firmwares for programming but they are locked to Freescale Devices. The CMSIS-DAP isn’t. The trade off is that you lose the Serial to USB lines on the OpenSDA programmer. Oh well.

Saturday, October 19, 2013

Random Trip to Alberta

AB Ride

2013-10-06 11.05.342013-10-06 11.05.56
As some of you may have read, I recently travelled to Alberta and I got to take my bike with me. Everyone had talked to me about riding from Canmore to Banff, but having seen the drive to Canmore from North West Calgary, it was a bit of a longer round trip plus I had to go Karting later that afternoon. A lot more after the break. Less powermeter, more adventure stuff.

Thursday, October 17, 2013

More on Accuity + Quarq

image

After spending a few nights dealing with the required decoupling math for the Quarq + Accuity unit I’m still not 100% there. I feel I’m 95% there, but something is eluding me.

The right measurement is dead on, within 1-3% of the Quarq.

The left measurement is another story ranging from 5 – 8% out.

What I thought was the original issue was due to the non-integrated spider and that I didn’t place the shear strain gauge deep enough down the hole. As a result it can see some of the stain caused by the torque on the right arm in the left sensor. A few ways of dealing with this:

  • Reinstrument with another strain gauge (about 3 evenings of work)
  • De-coupling Math (in theory short, but probably 3 evenings of work… to get right)

Essentially the math works by calculating the torque on right arm from the right strain sensor setup, and then subtracting that small percentage from the left arm. How much are we talking?

For every 1 N-M on the right arm, I can see 0.0075 N-M on the left arm. I messed up the math earlier which caused each arm to work nicely independently but together they didn’t work right which resulted in a significantly reduced measurement of power and the balance skewed 100% right.

Now that this is all sorted I have the problem that the Left sensor is reading low, both independently and concurrently. I can artificially dial it into the Quarq but I don’t believe that is the correct thing to do.

Question I’m trying to determine. Could the loss of torque due to the bottom bracket bearings be affecting the calibration? Would the Quarq have been calibrated for each side and then averaged? Am I missing something?

I was checking for force sensitivity due to twisting the arm and at best I could muster was adding more force, not losing it.

Other things of note

The small Sunnto style m-ANT (tiny) stick DOES NOT WORK with the old .NET libraries. You need the latest ones! Having realized that I’ve started using my double powermeter recording software with an AP1 or AP2 usb stick. I dislike how it sticks out on my laptop though. I think I just need to replace a .DLL file but haven’t tried it.

To summarize:

  • Carbon fibre remaining linear; multiple calibrations resulted in nearly the same numbers (18.62 versus 18.82 bits/N-M) with multiple points.
  • There is some permanent strain in the carbon caused somewhere between flying it from ON to AB. Didn’t affect calibration really.
  • Bad decoupling math was the problem with it not functioning correctly in AB and resulted in swapping to my Aluminum Rival Crank which still works very well.
  • Still investigating the small percentage difference between prototype and Quarq
  • m-ANT stick requires new libraries for .NET development
  • Samsung commits to ANT+; At least on flagship
  • If you have an idea on why my calibration might be off write me here

Personal notes: I wish that the Nexus 5 will be reasonably priced and have ANT+.

Tuesday, October 15, 2013

Short Break–Back Very Soon

There have been a lot of things going on in the background which has prevented me from posting anything for the last few weeks. I’m currently refining the Quarq + Accuity unit. It’s working well but there are some force sensitivity investigations that I want to conduct and I might want to reinstall the left leg sensing strain gauge.

Upcoming potential posts

  • Carbon, carbon, carbon – the good and bad. Surprisingly little bad thus far.
  • My interview with Auto21 which funded my Masters research. Canadian Automotive research at it’s finest
  • Potentially a biweekly podcast with some other good folks interested in cycling and power (still working out details).
  • Strain gauges and some issues
  • Trip to Alberta – Less bike related and didn’t make it to the ANT+ symposium but some fun things to do in AB. Must cycle Banff and Canmore next time. This time was just outside Calgary area cycling. Also, Go-Karts.