changing port 25 to port 4

Go To Last Post
14 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi to everyone,

I am trying to compile a short sketch for atmega328p  but the port given by windows changed from the time the file was created.

 

 


#include <avr/io.h>
#include <util/delay.h>

int main(void)
{
    DDRB |= 0B00100000;
    while (1) 
    {
		PORTB |= 0B00100000;
		_delay_ms(1000);
		PORTB &= 0B11011111;
		_delay_ms(1000);
    }
}

 

 

I cant, dont know, dont find, how to change it.  If I change in in Vmicro, the debugger always get me back with the old port and  the sketch cant be uploader with bootloader.

 

              Using Port                    : COM27
              Using Programmer              : arduino
              Overriding Baud Rate          : 115200
avrdude.exe : ser_open(): can't open device "\\.\COM27": Le fichier spécifié est introuvable.

 

 

Regards,

JPDaviau

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You need to contact the folks who make Visual Micro. There's very few people here who use it (because, frankly, it's pretty awful and now largely irrelevant).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
 Visual Micro ...  now largely irrelevant

@ j4e8a16n  - because what it did as an add-on to AS6 is now built-in to AS7

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So Atmel studio is useless. ?  Another useless big beast?

I did not used vMicro, it append that I saw the information in vMicro and tried to change it.

 

JPDaviau.

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

j4e8a16n wrote:
So Atmel studio is useless. ?  Another useless big beast?
No Atmel Studio is a great tool. It's the extension called "Visual Micro" that you have added that was a solution during AS6 to allow import of Arduino sketches. but then, in AS7, Atmel added their own solution to do this which made the Visual Micro thing a bit pointless. It was also "Adware" and tends to pollute things with annoying messages all the time.

 

As such loads of people here happily use AS7 but almost no one now uses the Visual Micro extension.

 

Visual Micro are here:  https://www.visualmicro.com/page/Arduino-for-Atmel-Studio-7.aspx  - might be best to approach them directly if you have a question about using their product.

Last Edited: Tue. Dec 10, 2019 - 01:52 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well,  where can I  take them off  in this big labyrinthus?

 

OK

Tools, extension ..../

Last Edited: Tue. Dec 10, 2019 - 02:23 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I took it of.

 

Same problem ?

Rebuild project

 

Arduino via bootloader:

 

avrdude.exe : ser_open(): can't open device "\\.\COM27": Le fichier spécifié est introuvable.

 

 

 

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

But that is nothing to do with Studio. You'd get the same error if you just run avrdude.exe from a Command Prompt.

 

AS7 does not natively know how to invoke avrdude. It is an external command. The only programmers/debuggers that AS7 knows how to operate are Atmel/Microchip ones.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I found where it comes from:

second line PCOM27

c:\users\another\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude.exe 
-C"C:\Users\Another\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf" -v -patmega328p -carduino -PCOM27 -b115200 -D -Uflash:w:"$(ProjectDir)debug\$(TargetName).hex":i 
============

I changed it  to   PCOM25  and upload via bootloader . It ..  works  or almost work  because the led dont blink.

 

========= OUTPUT:

 

avrdude.exe : Version 6.3-20190619
              Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
              Copyright (c) 2007-2014 Joerg Wunsch

              System wide configuration file is "C:\Users\Another\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

              Using Port                    : COM25
              Using Programmer              : arduino
              Overriding Baud Rate          : 115200
              AVR Part                      : ATmega328P
              Chip Erase delay              : 9000 us
              PAGEL                         : PD7
              BS2                           : PC2
              RESET disposition             : dedicated
              RETRY pulse                   : SCK
              serial program mode           : yes
              parallel program mode         : yes
              Timeout                       : 200
              StabDelay                     : 100
              CmdexeDelay                   : 25
              SyncLoops                     : 32
              ByteDelay                     : 0
              PollIndex                     : 3
              PollValue                     : 0x53
              Memory Detail                 :

                                       Block Poll               Page                       Polled
                Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
                ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
                eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
                flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
                lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
                signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

              Programmer Type : Arduino
              Description     : Arduino
              Hardware Version: 3
              Firmware Version: 4.4
              Vtarget         : 0.3 V
              Varef           : 0.3 V
              Oscillator      : 28.800 kHz
              SCK period      : 3.3 us

avrdude.exe : AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude.exe : Device signature = 0x1e950f (probably m328p)
avrdude.exe : safemode: lfuse reads as 0
avrdude.exe : safemode: hfuse reads as 0
avrdude.exe : safemode: efuse reads as 0
avrdude.exe : reading input file "C:\Users\Another\Documents\Atmel Studio\7.0\AtmelBlinkproject\AtmelBlinkproject\debug\AtmelBlinkproject.hex"
avrdude.exe : writing flash (188 bytes):

Writing | ################################################## | 100% 0.04s

avrdude.exe : 188 bytes of flash written
avrdude.exe : verifying flash memory against C:\Users\Another\Documents\Atmel Studio\7.0\AtmelBlinkproject\AtmelBlinkproject\debug\AtmelBlinkproject.hex:
avrdude.exe : load data flash data from input file C:\Users\Another\Documents\Atmel Studio\7.0\AtmelBlinkproject\AtmelBlinkproject\debug\AtmelBlinkproject.hex:
avrdude.exe : input file C:\Users\Another\Documents\Atmel Studio\7.0\AtmelBlinkproject\AtmelBlinkproject\debug\AtmelBlinkproject.hex contains 188 bytes
avrdude.exe : reading on-chip flash data:

Reading | ################################################## | 100% 0.03s

avrdude.exe : verifying ...
avrdude.exe : 188 bytes of flash verified

avrdude.exe : safemode: lfuse reads as 0
avrdude.exe : safemode: hfuse reads as 0
avrdude.exe : safemode: efuse reads as 0
avrdude.exe : safemode: Fuses OK (E:00, H:00, L:00)

avrdude.exe  done.  Thank you.

Regards,

 

JPDaviau

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

with regards to the led not blinking....

 

have you defined F-CPU to go with the delay function?

You should/could have had a warning about that.

default the delay function will calculate using 1MHz clock.

As you seem to be working with arduino, my guess is that you also use an arduino borad which runs at 12MHz ( or veen 16mhz not sure as I did not use them for a long time) so instead of a 1second blink you have a 83ms bink, so it will blink so fast you will not see it blink at all. The led will look dimmed though......

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

meslomp wrote:

with regards to the led not blinking....

 

have you defined F-CPU to go with the delay function?

You should/could have had a warning about that.

default the delay function will calculate using 1MHz clock.

As you seem to be working with arduino, my guess is that you also use an arduino borad which runs at 12MHz ( or veen 16mhz not sure as I did not use them for a long time) so instead of a 1second blink you have a 83ms bink, so it will blink so fast you will not see it blink at all. The led will look dimmed though......

 

 

 

 

The little steel box on the board shows T16.000 

 

I tried with a delay of 15000   and 1000 , 100000),  then I commented  //#define F_CPU 16000000UL  using 1000 : no blinking

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
#define F_CPU 16000000UL 
#include <avr/io.h>
#include <util/delay.h>

int main(void)
{
    DDRB |= 0B00100000;
    while (1) 
    {
		PORTB |= 0B00100000;
		_delay_ms(1000);
		PORTB &= 0B11011111;
		_delay_ms(1000);
    }
}

This code should toggle pin PB5 just nicely IF!! you actually run on the external 16MHz crystal, and not on the internal 8MHz RC with clkdiv8 fuse set ( then you actually only run at 1MHz so 1/16th of the speed thought)

 

you have checked your fuse settings and they are set to external crystal and the clkdiv8 fuse is cleared.

 

you could just simply write 2 programs to check if the LED is doing anything at all

 

 

 

#include <avr/io.h>
#include <util/delay.h>

int main(void)
{
    DDRB |= 0B00100000;
    PORTB |= 0B00100000;
    
    while (1) 
    {

    }
}

 

and

 

#include <avr/io.h>
#include <util/delay.h>

int main(void)
{
    DDRB |= 0B00100000;
    PORTB |= 0B00000000;
    
    while (1) 
    {

    }
}

 

the first program should give a LED that is always ON, and the second a LED that is always OFF.

that will confirm that you actually have connected the LED to the right pin and not reversed and that the dimming resistor is not to high/low in value

if the LED is not brightly on then there is something not OK with your hardware.....

 

What programmer do you use? PB5 is a ISP pin, so will be also attached to the programmer you use.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

 

By programmer you mean something like ICE?  = none

 

I am using simulator.

 

 

Although the lights flashes when uploading the sketch, in all 3 cases after loading the light is off.

 

For the fuse I dont know where to set it.

I found GDB settings  to AVR8

 

I tried the sketches with an atmega 2560  :  same results.

 

PIN 13 is the LED_BUILTIN    and  PB5

 

 

 

I don't know if all this is hepfull.

 

Many thanks for your attention.

 

 

JPDaviau

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi again,

 

?? Tried again with result that the light is always on.

 

I found the fuses :

 

BODLEVEL = DISABLED
RSTDISBL = [ ]
DWEN = [ ]
SPIEN = [X]
WDTON = [ ]
EESAVE = [ ]
BOOTSZ = 2048W_3800
BOOTRST = [ ]
CKDIV8 = [X]
CKOUT = [ ]
SUT_CKSEL = INTRCOSC_8MHZ_6CK_14CK_65MS

EXTENDED = 0xFF (valid)
HIGH = 0xD9 (valid)
LOW = 0x62 (valid)

 

Regards,

 

 

JPD