ATMEGA328PU - PB5 - PIN13

Good Morning,
on PIN 13 I've connected a RELAY ... this relays in during arduino boot-up change a couple of times a state ...

this i think is not a good thing for my circuit because the connected devices is turned on and off in couple of seconds ...

reading the datesheet seems that is a clock out also ...I don't know if is this the reason for this kind of behavior ...

SCK/PCINT5 – Port B, Bit 5
SCK: Master Clock output, Slave Clock input pin for SPI channel. When the SPI is enabled as a Slave, this pin is configured as an input regardless of the setting of DDB5. When the SPI is enabled as a Master, the data direction of this pin is controlled by DDB5. When the pin is forced by the SPI to be an input, the pull-up can still be controlled by the PORTB5 bit.
PCINT5: Pin Change Interrupt source 5. The PB5 pin can serve as an external interrupt source.

Of course I can connect my delays on another pin but the problem is that I've my printed circuit board already did ... and I would like to use this without change for the moment it ...

could be possible change this via software ?

Thanks in advance,

Gnux

Its because the pin floats before your sketch runs. Use pull-up/pull-down resistors to control the problem. Nothing you can do about in software.

Mark

Pin 13 is the onboard led for many Arduino boards.
The bootloader will flash it a few times.

It is also SCK for the SPI bus, but if the SPI bus is not used, that pin doesn't have that function yet. So that is no problem.

I think you have to use another pin.

Thanks to all for the information i will try

Gnux

I presume the atmega328p is on the PCB, rather than on an Arduino connected to the PCB. Did you include a 6-pin ICSP header on the PCB? If so, then you can program the chip using ICSP without a bootloader - which will fix the problem, because it is the bootloader that is pulsing that pin.

yes in the project there is burn the software via ISP :slight_smile: now I've discover how to burn it ... so right now I burning only boot loader but the software i didn't find again how upload via isp ...

regards,
gnux

Configure the hardware as if you are burning the bootloader. Then upload your sketch, but instead of clicking the Upload button, hold down the Shift key and click the Upload button (or select "Upload using programmer" from the File menu).

Hi :slight_smile:

so now I'm ok for:

  • upload boot loader ...

what I'm not able to do is :

  • Upload sketch via ISP from ARDUINO UNO into ARDUINO MEGA2560

Thansk for the support,
gnux

gnusso:
what I'm not able to do is :

  • Upload sketch via ISP from ARDUINO UNO into ARDUINO MEGA2560

Why not? What problem are you having?

Rightnow I follow this step:

  • put arduino like ARDUINO ISP

  • I use a cable that i use for upload via isp the bootloader

  • I set like arduino: Arduino 2560

  • open my sketch and with press shift key I did from file menu --> upload with programmer

the issues is this:

avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
this check.

avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout

What microcontroller exactly are you using on your board? The thread title mentions atmega328pu, so why are trying to build/upload for Arduino 2560, which uses a different processor?

btw as well as the atmega328-pu there is the atmega328p-pu, which is the one used on the Uno. They have different signatures. Make sure you know which one you have. If you select File->Preferences and then check "Show verbose output during upload", then I think it will display the device signature it finds when you try to upload.

Hi thanks for the information sorry for the delay burt I was at work a little bit busy ;-( ...
so this is the message. In my project I've 2 different arduino used ... UNO and 2560 then I will need to upload sketch into UNO and 2560. But if i will necessary I will do: UNO with ATMEGA328 and 2560 with atmega2560 ... What I don't understand is ...why I can upload with ISP cable that I've did (then I think is working with reset and other stuff...) I can uploader bootloader into ATMEGA328 and into ATMEGA2560 via isp and for the sketch I've this kind of issues ?

/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avrdude -C/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega328p -cstk500v1 -P/dev/tty.usbmodem621 -b19200 -Uflash:w:/Users/gnusso/Desktop/hex/_20130114_ServerRicevitoreNew.cpp.hex:i

avrdude: Version 5.11, compiled on Sep 2 2011 at 18:52:52
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch

System wide configuration file is "/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf"
User configuration file is "/Users/gnusso/.avrduderc"
User configuration file does not exist or is not a regular file, skipping

Using Port : /dev/tty.usbmodem621
Using Programmer : stk500v1
Overriding Baud Rate : 19200
avrdude: Send: 0 [30] [20]
avrdude: Send: 0 [30] [20]
avrdude: Send: 0 [30] [20]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding

avrdude done. Thank you.

Thanks for the support ...Gnux