Crashed and rebooting

The Kernel of vector quantities

This unexpected pleasure occurred in designing a light dimmer during the ‘boot-meet’ of Snubberless Triac from STMicroelectronics (Phillips called it ‘Hi-Com’ or as generic 3-quadrant Triac). It was the zero-cross detection circuit that wondered me at the unexpected pleasure. My ‘yes-nodding’ head started to spin intrinsically when the zero-cross detection circuit met its left-brain, the mighty Arduino. As the meeting was unaligned, the perfectly shaped waveform reformed to a slowly raising- and failing-edge waveform.

perfect_zero
Perfect zero-cross waveform from solitary (standalone) detection circuit

The characteristic of this newly reformed waveform was an uneven distribution (approximately a half-cycle of 11.6 ms and the another of 8.4 ms respectively) of cycles of AC mains. At first, I guessed that it might be a timing issue of the value of current limiting resistor of zero-cross detection circuit and the capacitance of the input pin (configured as level-triggered interrupt) of ATMega328P, oscillating on the floor of Arduino Uno. Acquired knowledge from the application note, AVR182 by ATMEL (now Microchip), I tried several values of the input series resistor but found hard luck (caution: luck has nothing do in engineering, only rules). And that ended my day.

As I started to shuffle my feet aiming to get the workplace on the next brand-new morning, my bypassing-mind started to design new, complex solution to bypass the problem without even understanding it properly (This bypassing habit became so acute that neither I can flush it out nor Amygdala can hijack it). Anyway, after reached to my workplace, I planned to make it fail again before started to apply new solution as learned a believable rule from the second-class Angel, David Agans. 

shifted_zero
Shifted zero-cross with interrupt pull-up enabled

I started to see a ‘hope-pulse’ at the first slight of my day towards the screen of hooked oscilloscope. What I observed was the perfect shape—sharp raising- and falling-edge again for a moment and then it became the uneven one. Now it’s high time to trump over the bypassing-mind logically in order to make the ‘hope-pulse’, a steady. I observed the perfect shape again as the innocent bootloader inside the Arduino controller did halt the user application firmware to configure the input pin as level-trigger interrupt pin along the way to the booting process. After finishing the boot up process, user application firmware did configure the input pin as level-trigger interrupt pin, so I did observe the uneven waveform again. This situation stimulated me to dive into the firmware code in order to conquer the unexpected pleasure. In the firmware code, what I found is I did configure the input pin as level-trigger interrupt input pin but enabled optional internal pull-up. Disabled the internal pull-up, downloaded the new binary stream into the Arduino and Bingo! After all, it was a hardware pleasure (no kidding, expected one) and my initial guess (timing issue due to RC network) was also right, only the firmware was in charge of it.

In the end, there wasn’t a sign of nerve-war since the hardware-brain and the firmware-brain confined in a single vector quantity (both quantities were marched together to form a new unified resultant quantity). However, this expected pleasure shaped the kernel—vector quantities with or without their invented machines are hot together, so hot together. Anytime and every possible where.

Leave a Reply

Your email address will not be published. Required fields are marked *