Welcome, Guest. Please login or register.

Username: Password:

Author Topic: Bootloader issue when burning it via Arduino Mega2560  (Read 2772 times)

grozmaistor

  • Full Member
  • ***
  • Posts: 11
    • View Profile
Bootloader issue when burning it via Arduino Mega2560
« on: April 29, 2018, 23:04:32 »

Hello Tom,
This is a great project! And as an amateur astronomer I am trying to make it work for me.

I am trying to build my own AstroEQ from the shared project on gitlab.
I have the PCB and all the components soldered on it.

Now I have an issue when burning the bootloader from gitlib project.

1. I am using Arduino IDE v1.8.5
2. as a programmer I am using Arduino Mega2560.
    On the mega the ICSP pins are 50,51,52,53 (instead of 10,11,12,13 on the UNO),  Vcc, Gnd

In order to program the AstroEq with the bootloader I programmed the Arduino Mega with the example project ArduinoISP that is to make the arduino a programmer. The example is given for Arduino UNO, so I replaced the digital pin definitions in the code to correspond to 50-53.

From an old arduino forum thread I have read your discussion from year 2012, so I made the adjustments on the Arduino
This is the thread:
https://forum.arduino.cc/index.php?topic=104693.0

Here in the boards.txt I have added your properties + one more:   atmega162.bootloader.tool=avrdude
and corrected the high fuses to be: 0xDC nstead of 0xD8

So the extra part in boards.txt looks like:

##############################################################

atmega162.name= ATmega162

atmega162.upload.protocol=arduino
atmega162.upload.maximum_size=14336
atmega162.upload.speed=57600

atmega162.bootloader.tool=avrdude
atmega162.bootloader.low_fuses=0xFF
atmega162.bootloader.high_fuses=0xDC
# atmega162.bootloader.high_fuses=0xD8
atmega162.bootloader.extended_fuses=0xFB
atmega162.bootloader.path=optiboot
atmega162.bootloader.file=optiboot_atmega162.hex
atmega162.bootloader.unlock_bits=0x3F
atmega162.bootloader.lock_bits=0x0F

atmega162.build.mcu=atmega162
atmega162.build.f_cpu=16000000L
atmega162.build.core=arduino
atmega162.build.variant=atmega162

##############################################################


I have added the pins_arduino.h to the folder you described and also replaced the iom162.h file.

As a result I have in Arduino IDE  ATmega162 as an option,

I try to burn the bootloader , arduino IDE actually burns it successfully , it takes a few seconds to do it, the arduino leds blink and the AstroEQ status led blinks several times while burning process. Status in IDE is success.

When I try to connect the AstroEQ to the computer via USB - there is nobody there. Windows does not detect the controller and no led blinks at all. Nothing in device manager.

Any help will be appreciated.
Thank you.




Logged
Grozdan Grozev, amateur enthusiast

TCWORLD

  • Administrator
  • *****
  • Posts: 809
    • View Profile
    • AstroEQ
Re: Bootloader issue when burning it via Arduino Mega2560
« Reply #1 on: April 30, 2018, 16:42:10 »

Have you programmed the PIC microcontroller?
Logged
Tom Carpenter (AstroEQ)

grozmaistor

  • Full Member
  • ***
  • Posts: 11
    • View Profile
Re: Bootloader issue when burning it via Arduino Mega2560
« Reply #2 on: April 30, 2018, 17:05:43 »

Hello Tom,
The small one I haven't programmed it the PIC micro controller.
I was thinking that after putting the boot loader in the chip then the device should appear and be recognised when plugged in with USB?

Did I miss anything else related with the boot loader?
May be I missed the steps and description for it in GitHub etc. and where should I read about it?


Greetings
Grozdan
« Last Edit: April 30, 2018, 17:29:38 by grozmaistor »
Logged
Grozdan Grozev, amateur enthusiast

grozmaistor

  • Full Member
  • ***
  • Posts: 11
    • View Profile
Re: Bootloader issue when burning it via Arduino Mega2560
« Reply #3 on: April 30, 2018, 22:43:04 »

Hello again,
Before uploading the firmware, do I have to program the PIC microcontroller with this hex file: AstroEQ USB-Serial.hex which is found under folder tree: AstroEQ-Firmware\Driver (Atmega162 Version) ?

I have found a way of flushing the PIC microcontroller with an arduino simulating the PICkit - it is the project by Kirill Kulakov in bitbucket called Arduino as a Pic18F programmer.
https://bitbucket.org/JoseFuzzNo/arduino-as-pic18f-programmer-for-linux.git

I guess after that I will be able to attach the AstroEQ controller via usb to PC and it will be recognised and I will be able to configure it with the config utility.

Is the above correct?

Regards
Grozdan

Logged
Grozdan Grozev, amateur enthusiast

TCWORLD

  • Administrator
  • *****
  • Posts: 809
    • View Profile
    • AstroEQ
Re: Bootloader issue when burning it via Arduino Mega2560
« Reply #4 on: April 30, 2018, 23:04:56 »

Correct. You need to program "AstroEQ USB-Serial.hex" onto the PIC.

The PIC acts as a USB to Serial converter, so until it is programmed, you won't see anything in device manager. The ATMega162 doesn't connect to the USB port, it talks via serial to the PIC.
Logged
Tom Carpenter (AstroEQ)

grozmaistor

  • Full Member
  • ***
  • Posts: 11
    • View Profile
Re: Bootloader issue when burning it via Arduino Mega2560
« Reply #5 on: May 01, 2018, 08:20:46 »

Hello Tom,
Thank you for the answer.
I will try it ASAP.

Greetings
Grozdan
Logged
Grozdan Grozev, amateur enthusiast

grozmaistor

  • Full Member
  • ***
  • Posts: 11
    • View Profile
Re: Bootloader issue when burning it via Arduino Mega2560
« Reply #6 on: May 01, 2018, 17:50:42 »

Hello again,

Unfortunately the Bitbucket project for programming the AstroEQ PIC controller hasn't worked for me.
That project is originally made to support pics of the series: PIC18F2420 and then extended to:
        18F2420
   18F2455
   18F2520
   18F2550
   18F4420
   18F4455
   18F4520
   18F4550

but only the 18F2550 and 18F4550 have been tested, it is written in the readme, and AstroEQ's pic is PIC18F14K50.

Has anybody tried it anyway?
Logged
Grozdan Grozev, amateur enthusiast