New atmega238p works way too *slow*

hey, Or ordered new atmega238's from digikey, but they work reaaally slow :confused:

ones that I ordered: https://www.digikey.fi/product-detail/en/microchip-technology/ATMEGA328P-PU/ATMEGA328P-PU-ND/1914589

For example I have initialize loop in code:

  for (auto& field : fields) {
    knx.addListenGroupAddress(field.addr);
    pinMode(field.port, OUTPUT); //Sets the Pin to output
    digitalWrite(field.port, !field.value); //setup pins: lastValue 1 sets pin to 0 (activates it)
    delay(50);
  }

If running with old atmega I can't see delay, releays works like virtually same time, but with new one, I can actually count them, took like second to do full array that has 16 entitys.

same code, same programmer, same hardware to insert them. I try do do multiple times but no luck, new ones are always slower :confused:

new(slow) atmegas RS connections doesnt work at all, I think its something to do with speed.

this chip works perfectly:

this one doesnt:

Does the basic LED blink program flash an LED at the right speed ?

How did you flash that AtMega? Out of the box ( as it comes from ATMEL/MicroChip ) the processor runs with its internal oszilator and the clockspeed is 1MHz. You have to set the fuses correctly to use an external 16MHz quartz.

no, it change state every 8-9 sec

oo, that would explain alot of stuff, but I choose "upload using programmer" and selected arduino pro -> 5V / 16MHz

I tought that overwires bootloader with selected board settings

so do I first need to burn bootloader and then overwrite it :o

Edit:
ok, if I first burn bootloader and then send program, it works.

I really thought it would send those fuses sametime depending what board you have chosen :confused:

Uploading the code does not change the fuses, these are 2 discrete steps. The IDE builds code to run on the speed of chip you select, making the 'timing' correct for delays etc.
When you program the fuses, this sets the CHIP to use the correct timing method, eg Internal Oscillator at various speeds, or use external clock sources, these can be almost anything from 32 KHz to 20 MHz.

You are not the first to be caught out by this, and you will not be the last. I've had a large, online retailer of electronics send me a board that did not work as designed, and it was down to the fuses!

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.