Saturday, July 7, 2007

Production

We will keep separate room for production. I spent three hours assembling all the equipment and tools required for optics assembly. If some were lost, it would have taken even more time.

We will complete the assembly instructions. The need was verified by redoing calibration again and again because of minor errors. A nice checklist would have saved a lot of time.

Thursday, July 5, 2007

Microstepping


Microstepping lets steppers work much faster and more reliably, not to mention smoother ride :P

The TCA3727 (looks like it will be obsolete shortly) has the following nice diagram explaining microstepping currents.

Stepping table is as follows:
#define I10 _BV(STEPPER_I10_PIN)
#define I11 _BV(STEPPER_I11_PIN)
#define PH1 _BV(STEPPER_PH1_PIN)
#define I20 _BV(STEPPER_I20_PIN)
#define I21 _BV(STEPPER_I21_PIN)
#define PH2 _BV(STEPPER_PH2_PIN)

static const u08
stepper_steps[] PROGMEM = {
I10 | I11 | 0 | PH2 | 0 | 0, // 0
0 | I11 | PH1 | PH2 | 0 | 0, // 1
I10 | 0 | PH1 | PH2 | 0 | 0, // 2
0 | 0 | PH1 | PH2 | 0 | 0, // 3
0 | 0 | PH1 | PH2 | I20 | 0, // 4
0 | 0 | PH1 | PH2 | 0 | I21, // 5
0 | 0 | PH1 | PH2 | I20 | I21, // 6
0 | 0 | PH1 | 0 | 0 | I21, // 7
0 | 0 | PH1 | 0 | I20 | 0, // 8
0 | 0 | PH1 | 0 | 0 | 0, // 9
I10 | 0 | PH1 | 0 | 0 | 0, // 10
0 | I11 | PH1 | 0 | 0 | 0, // 11
I10 | I11 | PH1 | 0 | 0 | 0, // 12
0 | I11 | 0 | 0 | 0 | 0, // 13
I10 | 0 | 0 | 0 | 0 | 0, // 14
0 | 0 | 0 | 0 | 0 | 0, // 15
0 | 0 | 0 | 0 | I20 | 0, // 16
0 | 0 | 0 | 0 | 0 | I21, // 17
0 | 0 | 0 | 0 | I20 | I21, // 18
0 | 0 | 0 | PH2 | 0 | I21, // 19
0 | 0 | 0 | PH2 | I20 | 0, // 20
0 | 0 | 0 | PH2 | 0 | 0, // 21
I10 | 0 | 0 | PH2 | 0 | 0, // 22
0 | I11 | 0 | PH2 | 0 | 0 // 23
};

#undef I10
#undef I11
#undef PH1
#undef I20
#undef I21
#undef PH2

When doing it step-by-step, some steps seem to be less "powerful" than others. It doesn't run _very_ smoothly on higher speeds. Perhaps some tweaking with step timings is neede in order to achieve really smooth operation.

Bugger lost it :)

Got this bugger to work. Turned out that the debugging output interfered with the timing of communications.

The mitutoyo cable was misconnected, thus I reconnected it and presto - all works fine!

Wednesday, July 4, 2007

Harvard Architecture Lesson

AVR has Harvard architecture. The program and data memory are totally separate entities. However, pointers to program memory have the same type as pointers to data memory.

This solved my yesterdays mysterious printouts. I was passing "const char*" to a function that was expecting "const prog_char *".

Saturday, June 30, 2007

Farewell

I managed to finish firmware yesterday. Good!

Yesterday afternoon I had a long farewell lunch at the airport with our guest from France. He is a rather smart guy, who had been staying at the Institute for a month trying frantically to use our main product for real and succeeeding in that. Despite all the problems; including starting working week later than planned. I always felt that we were not treating him nicely because we had been busy doing other thing and not going out for lunch or giving him too little support using our products. However, much to my surprise he said that compared to his previous stay in German (three months) we were very friendly and supportive. In fact, he invited me to visit France and I promised to do so.

Beforehand I was very reluctant to spend some extra time, but now it looks like time well spent. Time spent with our clients is rarely time wasted.

Friday, June 29, 2007

Today I still have my hands at the same firmware I had on Monday. The spec is four pages long and I made an improvement today, which will be implemented tomorrow - FIVE DAYS LATER.

It is time to improve my spec-writing skills and reap the benefits of thinking before diving straight into the code.

Thursday, June 28, 2007

One-liner (almost) CRC.

Dallas iButton 8-bit CRC calculation.
Source: http://www.maxim-ic.com/appnotes.cfm/appnote_number/27
Polynomial: x^8 + x^5 + x^4 + 1 (0x8C)
Initial value: 0x00

uint8_t
_crc_ibutton_update(uint8_t crc, uint8_t data)
{
uint8_t i;
crc = crc ^ data;
for (i = 0; i < 8; ++i) {
crc = (crc << 1) ^ ((crc & 0x01) * 0x8C);
}
return crc;
}