Skip to main content
13 events
when toggle format what by license comment
Oct 27, 2022 at 1:36 comment added DKNguyen @slebetman I see......
Oct 27, 2022 at 1:27 comment added slebetman @DKNguyen From what I know, not all PICs select clock by running first and examining instructions. Some (all?) PICs select the clock source by hardware controlled by the fuse bits. It may look like instructions to you the programmer because it is compiled into a single hex file but the fuse bits are not instructions. They are generally special EEPROM cells hooked up directly to various hardware parts (eg. gates and multiplexers) to configure the MCU.
Oct 26, 2022 at 18:06 comment added DKNguyen @Opifex I was speaking from experience with PICs and STMs, not AVRs.
Oct 26, 2022 at 15:48 history edited Kevin White CC BY-SA 4.0
added 186 characters in body
Oct 26, 2022 at 15:05 comment added Opifex I'm not sure if what is being told here in the comments is 100% correct in the context of AVR. (It is for e.g. STM32) On an AVR, you select the desired clock by flashing fuse-bits. This is done through a programmer, but it's not part of the binary you are uploading. E.g. see here: engbedded.com/fusecalc
Oct 26, 2022 at 12:11 comment added hcheung @Newbie, What fuse bits to config depend on which specific MCU you are using, you asked a generic question, and you got multiple answers. If you want to know how to set the fuse, pick one specific MCU that you are interested and read the datasheet. Also most of the compiler tool chain will allow your to configure the fuse settings.
Oct 26, 2022 at 6:05 comment added user220456 @Justme , could you tell me what are fuse bits or confg bits?
Oct 26, 2022 at 5:55 comment added Justme @DKNguyen Depends on MCU. Not all MCUs start with internal clocks nor have software selectable clocks. For example some AVRs and PICs have "fuse bits" or "confg bits" for many things like clock selection which you can change with a programmer, JTAG or In System Programming interface.
Oct 26, 2022 at 3:55 comment added DKNguyen @Newbie Your phrasing makes it sound like you think we hook up the JTAG and then change a setting so the MCU uses a different oscillator. This is not the case. The MCU always boots up using the internal oscillator. It then starts to run the code you uploaded to it with a JTAG or SWD and if those instructions contain something to tell it to change to the external oscillator, it does. If it doesn't, it doesn't.
Oct 25, 2022 at 18:49 comment added user220456 Oh, so initially, we just provide power to the MCU. Once power is provided, using JTAG, or SWD or some other debugging interface, we program the MCU to use the internal or external clock, right?
Oct 25, 2022 at 18:48 comment added Stack Exchange Broke The Law @Newbie the ones I know do not use JTAG for programming - but yes, it's based on the programming.
Oct 25, 2022 at 18:47 comment added user220456 Thank you for the answer. So, the option to select the internal or external clock is based on the JTAG programming?
Oct 25, 2022 at 18:35 history answered Kevin White CC BY-SA 4.0