1

enter image description hereHi,

I'm designing a custom board with the ATMEGA32U4, with a GPS receiver and LoRa radio and it is powered from a LiPo battery. Since I'll need to make hundreds of this board later on, I'd like to program them over USB. I started out from the Arduino Pro Micro schematic and I use an 8MHz crystal. I'm able to make use of the factory default USB bootloader and upload Arduino sketches using the dfu-programmer in Linux. My first problem was that the blink example didn't really blink at 0.5Hz rate(delay(1000) wasn't 1sec), but much-much slower. No worries, reduce the delay a little bit. However, when I want to communicate with the GPS, the from the transmitted signal, I can see that the baud rate is not correct. I suspect that the clock settings are not correct. I read that these can be changed with the help of fuses, but as far as I know, they cannot be modified using only USB , I need a programmer for that, which I'd like to avoid. (Correct me if I'm wrong here)

So my question is, how do I set up the MCU correctly, so that it runs from the 8MHz external or 8MHz internal clock using only USB? Is it even possible?

7
  • 1
    Off topic: You can measure Vbatt by using it as AREF and measure internal bandgap voltage reference (= switch to the correct adc channel and measure it) Commented Oct 8, 2020 at 14:39
  • 1
    BTW, have you selected correct speed for pro micro board? (eg. 3V3/8MHz?). Also by default there is CKDIV8 fuse set, so if you didn't changed anytning in fuses, it'll be even slower than just half speed Commented Oct 8, 2020 at 14:44
  • Thanks for the tip regarding the battery voltage! Yes, I switched to 3v3/8MHz. In the meantime, I found this: avrfreaks.net/forum/clock-select-register-instead-fuse-bits I was able to switch the clock source back to 8MHz and the UART baudrate seems okay now. Commented Oct 8, 2020 at 15:28
  • Yes, it's possible to change prescaler, but you have to configure it in each program you create. Commented Oct 8, 2020 at 15:39
  • I'd still try to set the fuses. Using software to select the correct clock source and prescaler seems to me like a workaround, instead of proper solution. Though I can't give a good reason why. It just feels wrong. Commented Oct 8, 2020 at 15:47

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.