Josef 'Jeff' Sipek · @jeffpc
139 followers · 993 posts · Server mastodon.radio

I've been building a MAX7221-inspired -powered code to drive up to 16 7-segment digit display. For whatever reason, it was trying to display N-1 blanks and a "0" as the first digit when fed with valid input. After several evenings of debugging, I realized that I had the SDI wire hooked up to the wrong pin on the . *facepalm* Moving the wire to the correct place made everything work.

#electronics #avr #spi #atmega48

Last updated 1 year ago

Josef 'Jeff' Sipek · @jeffpc
129 followers · 806 posts · Server mastodon.radio

This morning, I looked through the datasheet for the and was reminded that waking up from sleep takes some time - specifically, 4 cycles to go from idle to ready for the interrupt handler. So, I took the sleep out from the code hoping to see the 10-11 cycles turn into 6-7 cycles...but nothing changed. Hmm...

#electronics #atmega48

Last updated 1 year ago

Josef 'Jeff' Sipek · @jeffpc
129 followers · 804 posts · Server mastodon.radio

Tonight's experiment was about looking at the pin change interrupt latency. The was externally clocked at 10MHz and PB0 was supplied with a 1Hz signal in phase with the clock. The pin change ISR simply strobes PB1. I measured the delay between the PB0 and PB1 rising edges.

The latency was either 1.02us or 1.12us, which is 10 or 11 clock cycles + 20ns. 😢

Then I changed the PB0 square wave to 33Hz and measured again: 1.02-1.22us, with just about every value in between.

#atmega48 #electronics

Last updated 1 year ago

Josef 'Jeff' Sipek · @jeffpc
126 followers · 761 posts · Server mastodon.radio

Me a year ago: whoa! I can look at waveforms which change in less than a microsecond!

Me now: This microcontroller has a 27ns delay between the clock's rising edge and the rising edge on the GPIO pin that it sets. That's boring.

Ok, it actually is impressive that a cheap microcontroller can do that. The jitter on the GPIO pin is rather good too - the period of the toggled pin has a 265ps stddev.

#atmega48 #electronics

Last updated 1 year ago

Josef 'Jeff' Sipek · @jeffpc
83 followers · 262 posts · Server mastodon.radio

So, what am I making? I'm building a BME280-based temp/pressure/humidity logger. I know I'm not the first and won't be the last.

Once a minute, the gets the current measurements from the via SPI and dumps the raw 8-byte measurement to the serial port. The next step is to make it log the data to an SPI flash as well.

For example, the measurement '5428007e8e004a95' translates to 19.386 degC, 1015.645 hPa, 33.671%rh.

#elecronics #bme280 #atmega48

Last updated 2 years ago

Josef 'Jeff' Sipek · @jeffpc
83 followers · 258 posts · Server mastodon.radio

The feeling when you program a microcontroller for a 4 second periodic interrupt, measure 4.03125 seconds, and when trying to calculate the amount of compensation you realize that you have an tick error which equates to 31.25ms. After fixing it, you get 4.00000241 seconds on the counter. 🤦‍♂️ Not bad for with a 32768Hz crystal. 😎

#electronics #atmega48 #offbyone

Last updated 2 years ago