38
votes
Accepted
Why is crystal frequency often multiplied inside a microcontroller?
As crystal frequency gets higher, dimensions get smaller (especially thickness). Above roughly 50 MHz, AT-cut crystals become fragile, and manufacturers use third-overtone cuts for higher frequencies.....
32
votes
How can you achieve decent clock accuracy in microcontrollers (e.g., max 1 second drift in a year)? How do digital watch manufacturers accomplish it?
Have you tried comparing with what accuracy you actually get from a digital watch? I don't remember them delivering "1 second per year" accuracy.
The crystal you linked was 50ppm. The ones ...
31
votes
Accepted
Why are Ethernet MAC and PHY separate?
PHY requires some fairly beefy pin drivers as well as analog signal processing on the receive side. The fabrication processes to support this well are not optimized for high-density digital logic, ...
29
votes
Use cases for RAM-less microcontrollers
It is very low power.
The chip does have RAM: 32 registers that are preserved over power-down mode, which draws less than 1µA. It also has EEPROM.
You'd typically use a chip like this for data logging ...
25
votes
Accepted
Has anyone measured what a high-impedance pin looks like?
High impedance pins on an IC may be a varied range of voltage anywhere between the negative and positive supply rails.
Without outside interference the voltage level will be determined by what is ...
24
votes
Accepted
Why does compiler optimization flag cause function definitions other than main() to break program in AVR ATMega C code?
These are not bugs that you are encountering. The problem goes deeper than just compiler optimization flags. It is a pure coincidence it happens to work at all.
The code isn't compiled properly ...
22
votes
Has anyone measured what a high-impedance pin looks like?
The trouble with measurement is that you need to retrieve energy from the system being measured, in order to determine its state.
The very act of measuring is going to influence that state. One of the ...
22
votes
Is it ok to set the unused I/O pins of the ATmega8A to input and connect all of them to ground
The ATMega8A Datasheet p.61 states:
13.2.4 Unconnected pins
If some pins are unused, it is recommended to ensure that these pins have a defined level. Even though most of the digital inputs are ...
20
votes
What is the maximum voltage of an AAA battery?
The 1.8V cell in the paper you linked is a lithium primary cell. Most consumers would consider that a risk-free premium upgrade to an alkaline cell and would insert it without a thought.
Measuring ...
20
votes
Are high speed crystals better at something compared to 32768 Hz crystals?
You simply cannot derive any arbitrary clock from 32768 Hz. Your PLLs can typically only do integer multiples, and with the dividers in typical MCU clock trees, you could do but a very limited set of ...
18
votes
Accepted
RJ45 with LED connections
You can't. That's not the way it is done.
The LEDs can not be connected directly to Ethernet wires.
The LEDs are controlled by the Ethernet PHY chip which communicates on the link.
The PHY chip will ...
17
votes
Accepted
How does one go about learning to program a new micro controller?
Generally speaking you won't find all the information in a single document on newer 32-bit MCUs. The "data sheet" is more like a light overview of capabilities with electrical ...
17
votes
Relay "latches" (doesn't turn off) after being turned ON for a very long time
and I connect a multimeter across pin 1 to check the voltage, the relay immediately turns OFF.
This is the clue. There is enough leakage current, likely from collector to base of T2 to keep the ...
17
votes
Loading LSB first or MSB first?
Maybe chapter 11.2 of the datasheet points you in the right direction:
The high byte is updated with the contents of TMR0H when a
write occurs to TMR0L. This allows all 16 bits of Timer0
to be ...
17
votes
What's a good way to assert in embedded microcontroller code?
It depends.
On an ARM platform there are very low level error handlers which indicate that some kind of low level problem has occurred (e.g. illegal memory access) and these need to have specific ...
16
votes
Use cases for RAM-less microcontrollers
Such very low end microcontrollers are pretty much intended exclusively for high volume commercial consumer electronics where the price is everything and one can compromise a lot about quality and ...
15
votes
How does one go about learning to program a new micro controller?
ST Microelectronics separates things into Datasheets and User Reference Manuals. The datasheet has part specific information while the reference manual has the information common between parts of a ...
15
votes
Accepted
What's a good way to assert in embedded microcontroller code?
The assert function as such is problematic, as you've probably noticed since you asked this question. No, using it is not good practice. Do not mix up "lots of ...
15
votes
Are high speed crystals better at something compared to 32768 Hz crystals?
STM32L4 cannot directly use the LSE as a PLL source. The reason for this is also the reason why you'd prefer a higher frequency crystal: phase noise.
The 32768 Hz crystal oscillator generates a sine ...
14
votes
Has anyone measured what a high-impedance pin looks like?
Typical output leakage currents are probably ~10nA at room temperature. The 1uA or even 10uA often shown as the limit in datasheets is grossly higher than the typical to account for elevated ...
13
votes
Use cases for RAM-less microcontrollers
The point is not about having no RAM. The point is, you can use it in any application where you need some kind of chip that does very simple things cheaply, but such an ASIC does not already exist or ...
13
votes
How can I connect multiple potentiometers (~20) to my Arduino without having to have 20 analogue pins?
You could use the 74HC4067 analogue multiplexer.
You need only one of the Arduino ADC-channels and 4 I/O-pins for switching between the 16 analogue channels.
The ATmega328P has 8 ADC channels, so you ...
13
votes
Accepted
Is it ok to set the unused I/O pins of the ATmega8A to input and connect all of them to ground
Your solution will work. There are other options too, as wiring them directly to ground will prevent the use of those pins easily in case you need more pins for temporary testing and debugging.
...
13
votes
Why does compiler optimization flag cause function definitions other than main() to break program in AVR ATMega C code?
You know that something goes really wrong when at address 0 there is no vector table, which would be an array of RJMPs or ...
12
votes
How can you achieve decent clock accuracy in microcontrollers (e.g., max 1 second drift in a year)? How do digital watch manufacturers accomplish it?
The 16 MHz crystal part in your link has 30 ppm initial tolerance and 50 ppm temperature stability. It has also specified aging of 3 ppm during first year and 1 ppm per year afterwards.
To put that ...
12
votes
Accepted
Relay "latches" (doesn't turn off) after being turned ON for a very long time
It sounds like your optocoupler is leaking a small amount of current when it heats up and is turned off (or under some other condition that happens after a while). This small current is being ...
11
votes
Use cases for RAM-less microcontrollers
I've used an ATTINY10 like this, and it's low pin count and very low power.
It can't do much, it only fits 1k of FLASH, that's less than 1 thousand instructions. You can barely compile any C code for ...
11
votes
Accepted
Does lower voltage mean lower power consumption?
This can only be general guidance -- for specifics you need to scrutinize data sheets, and since part availability will be an issue, do some competing design studies.
All else being equal, a given ...
11
votes
Why is crystal frequency often multiplied inside a microcontroller?
That is because it is easier to use a low frequency crystal as a reference for any arbitrary frequency you want to run the MCU at, like higher frequencies such as few hundred MHz or even slower than ...
11
votes
Why is crystal frequency often multiplied inside a microcontroller?
A crystal is rarely used at its native frequency. Its main purpose is to provide a system timebase, so that everything derived from this crystal will agree on the exact time. For this purpose, the ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
microcontroller × 9388stm32 × 896
pic × 872
arduino × 743
c × 620
embedded × 503
adc × 431
avr × 412
microchip × 365
voltage × 300
arm × 284
mosfet × 278
led × 277
programming × 271
pwm × 262
uart × 260
power-supply × 259
sensor × 252
i2c × 250
spi × 241
usb × 235
atmega × 231
digital-logic × 211
interrupts × 206
transistors × 201