I know I deserve the trouble as a punishment for buying a non-genuine Arduino Pro Mini. Shame on me.
Still, this might serve as a warning to others - be careful and check the actual voltages of the board you have bought!
Here's what's happened. I ordered two Pro Minis selecting 5V 16MHz flavor. But when I measured some output voltages on pins, I noticed they are in 3.3V logic range.
When I feed 6V on RAW pin, VCC also gives 3.3V. So, maybe they messed things up and soldered the wrong voltage regulators. It's easy to mess up, because they are offering both 5V and 3.3V flavors with the same board layout.
How do I know it's actually not a valid 3.3V Pro Mini with a 8MHz crystal? Because when I upload a program using board = pro8MHzatmega328 (in PlatformIO), everything starts going twice as fast - LEDs blink fast, and even the serial baud rate is doubled. Fortunately, I'm using SPI upload method without a bootloader, so the problem does not affect uploading.
So, my guess is that I have some kind of messed up Pro Mini at 3.3V with 16MHz, which should not exist and, very likely, might not work reliably anyway.
I was looking into fuses to see if I could manipulate them to somehow force the board to work at 8MHz because that would be safer for 3.3V, but I found out that both 8 and 16MHz Pro Mini versions normally have the same fuses. Mine says:
avrdude: safemode: Fuses OK (E:FD, H:DA, L:FF)
So, I guess my best option would be to apply stable 5V on VCC and ignore the built-in voltage regulator and treat the board as 5V 16MHz Pro Mini, right?
Or is there a simple way to cheat the MCU to run at 8MHz and then treat the board as a normal 3.3V pro8MHzatmega328?
The problem is that your crystal/resonator is 16MHz. So it looks like it has the 16MHz bootloader, but just has the wrong regulator populated. I think you can power it directly from the 5V pin, but if the regulator gets hot, you can remove it, or just cut its output pin or trace.
The Arduino Pro Mini is SparkFun's minimal design approach to Arduino. It's essentially a 3.3v Arduino that runs an 8 MHz bootloader on a super small, super thin board. There are no connectors attached - allowing you to add whatever connectors or wire you want without too much trouble.
Good idea, I'm just still a bit confused regarding all that fuse / prescaler / board_build.f_cpu stuff and not 100% sure which ones control only the software timers (to avoid double / half speed issues) and which ones actually control the speed of the MCU itself. And when I look at the fuse calculator at eleccelerator website, my brain overheats from all the options they are offering for the LOW byte - I do not recognize any of those options as "run at half the oscillator frequency".
The fuses are the same for the 16MHz and 8MHz Pro Minis, but the bootloaders are different. That's where the crystal speed is recognized. I believe the crystal speed is in the F_CPU variable, which will be either 16000000 or 8000000.
So what is it you want to end up with? Many sensors are 3.3V so being a 3.3v is not so bad.
Can you read the frequency on the crystal?
BTW I've bought many Pro Mini's and most of them are "clones" I've never had any hardware issues and I'm not particularly careful with them physically.
Yes, 3.3V would also be ok in my case, but I would like to make the MCU work at 8MHz, if it's possible at all, just to be safe against instabilities caused by 3.3V@16MHz.
The crystal has only letters AB on it.
After some reading, as I understand it, F_CPU does not control the speed of the MCU but only tells the software the actual speed to run at, to match the MCU.
However, the prescaler might be the one to change - to make the MCU run slower than the crystal. Also, CKDIV8 fuse could be used to run at 1/8 of the crystal frequency, which means 2MHz, and maybe that would be even OK for my project, but I'd better avoid touching fuses. So, I'll try experimenting with prescaler and then adjust F_CPU accordingly.
It's never been clear to me whether changing the prescaler solves the 3.3V vs 16MHz problem. Will the crystal oscillator itself still work ok at 16MHz at 3.3V? I don't remember seeing anything in the datasheet suggesting this solves the problem. And all the stuff that happens on powerup - does that all work properly too?
If you can get to it, it might make sense to change out the regulator to 5V if you can find one with the right pinout.
To be sure about the crystal frequency, you could flash the 16MHz bootloader, then just run the Blink example sketch. If it blinks at the right speed, then the crystal is 16MHz. But I thought you already concluded it had to be 16MHz per your first post.
Without knowing what circuits in the MCU are at risk at the lower voltages, it is impossible to know if changing the clock divider will be of any benefit.
I see 2 "safe" options:
Remove the regulator and power from a 5 volt supply.
Replace the regulator with a 5V device.
Having said that, I've been running a 3.3v ProMini with 5 V into the Vin (aka Vcc) pin with no issues. According to the data sheet on the 3.3v regulator this will be OK as long as there is no load on the Vraw pin.
You could always purchase another clone board. There are plenty on eBay. If you feel it is proper to support Arduino (I would agree) you could always just donate some amount to them.
BTW I have a number of ProMini clones "in the field" and have had zero issues. And although I know better I've never been particularly carefully with these boards (with regard to handling and possible exposure to ESD).
I just did it using a bit more "newbie-friendly" syntax:
#include <avr/power.h>
void setup() {
// for the strange Arduino 3v3 at 16MHz to make it run at 8MHz
clock_prescale_set(clock_div_2);
And, of course, I'm flashing it with board = pro8MHzatmega328, so it sets the right F_CPU at 8MHz to match 16/2 prescaler. Now my serial input is being interpreted at the right baud rate.