Baudrate needs doubling

I’m not sure if this is the correct category to post this...but I’ll try it. Please let me know if this is off topic.

Background: Lately I’ve been using ATMEGA328P with internal 8mhz crystal on a breadboard. I use a raspberry pi to program using geany text editor, then compile with Arduino Makefile, and upload with avrdude from terminal. I really enjoy this workflow because it’s fast and I can easily automate. (I’m a tweaker, make a small change, view results...I have so many ATMEGA328P’s that I don’t mind if I exceed flash writes and brick a couple while I learn and work things out)

Most of my work hasn’t been timing critical until I wanted to tx midi at 31250 baud rate. Midiox on windows just received garbage. So I got out a scope to read the output of ATmega328p. Comparing my computer generated midi note on message to the of the ATmega328p generated tx, the ATmega328p was half the speed it needed to be. I set the baud rate to 62500 and all was well. (This was actually my first time using a scope other than one time in college a long time ago. It to belong my friend’s father who recently passed and I have it on loan. It’s old and not fancy...but it works and has a manual. It felt great and I was able to actually troubleshoot)

My assumption is that something is set up for 16mhz external xtal...but where?

Fuses? Avrdude? Arduino Makefile? I’m thinking it might be the latter? But I don’t know where or how to make the correct adjustments.

In the past I used Arduino IDE with ATmega328p 8mhz breadboard in boards.txt then upload to a bootloaded Atmega328p through an Arduino connected via USB. Midi at a 31250 baud rate tx’d From the ATmega328p was fine under this set up. So I think all of my ATMEGA328P’s still have all the fuses set from bootloading and coding from those days...but how to check? I don’t know, yet!

I figure before I continue further with my Pi programming setup I better work out this clock issue as I’m sure it will keep rearing its ugly head!

I know my setup is non traditional, so I hope someone might be able to help. Thanks for reading!

Omg. So easy.

All I had to do was add this line to Makefile:
F_CPU=8000000L

I will need to learn more about defining custom board settings using Makefile and avrdude.

Also I’m still in the grey area about bootloading and need to do more research about what to do if I get a totally blank ATmega328p and program it with RASPi. I bootloaded all my ATmega328p’s when I got them.