Programming Arduino proc in Hilltopper-20


Ted
 

Hi, all.

While I try to whittle away at the loud "pop" each time I send a CW character and get more RX audio out of the volume knob, I'm also reading up on a mod for different tuning steps & even an LCD screen (for learning purposes only, really).  How does one actually connect to the processor to download/upload sketches to it? 

Does one connect to one of the un-pinned ports in the radio such as J6 or does the proc have to come out and sit on a burner type board?   I know just enough about Arduino programming to really make a mess but we have to start somewhere. 

Tnx in advance,

Ted
K3RTA


John Lonigro
 

Ted:
The short answer is you need to put the chip into a PIC Programmer, in order to program it.  Reading a PIC is sometimes impossible because they have a provision for locking the code from being downloaded; for example, to protect code that might be proprietary.  But if you were able to read it, you should expect to see pages full of 0's and 1's.  There's no room on a PIC for source code or comments (or any reason to have them there).

The term "sketch" is normally used in reference to Arduino code.  The heart of an Arduino is simply another brand of microcontroller.  While it may seem you are uploading a sketch to the device, the sketch stays on your computer and the compiled and linked code (0's and 1's) is sent to the microcontroller.  If you are able to download the program from an Arduino, you would not see anything resembling a human readable sketch.  Again, it would be 0's and 1's.

The bottom line is, practically speaking, you really need the source code to make sense of what the PIC is doing and to have any chance of modifying it.  If somebody has somehow come up with an alternate version of the original PIC program, your best bet would be to program another PIC (using the appropriate PIC programmer) and keep the original in a safe place, in case you need to restore things to their original configuration.  And hope the modified PIC code didn't damage anything on the radio.

72,
John, AA0VE

On 2/8/22 07:36, Ted via groups.io wrote:

Hi, all.

While I try to whittle away at the loud "pop" each time I send a CW character and get more RX audio out of the volume knob, I'm also reading up on a mod for different tuning steps & even an LCD screen (for learning purposes only, really).  How does one actually connect to the processor to download/upload sketches to it? 

Does one connect to one of the un-pinned ports in the radio such as J6 or does the proc have to come out and sit on a burner type board?   I know just enough about Arduino programming to really make a mess but we have to start somewhere. 

Tnx in advance,

Ted
K3RTA


WA4EFS
 

The Hilltopper 20’s J5 connects to the MPU’s Tx, Rx, and reset pins. You can connect to J5 from an UNO board’s DIO 0, 1, ground and reset or alternatively using a USB-FTDI cable, but you do need the reset pin to program.  J6 is the i2c bus, which is not used for programming.

 

I recommend stashing the original ‘factory programmed’ MPU safely away in a drawer, and using a copy for experimenting.

 

73, -Lloyd (WA4EFS)

 

From: main@4SQRP.groups.io [mailto:main@4SQRP.groups.io] On Behalf Of Ted via groups.io
Sent: Tuesday, February 08, 2022 8:36 AM
To: main@4SQRP.groups.io
Subject: [4SQRP] Programming Arduino proc in Hilltopper-20

 

Hi, all.

While I try to whittle away at the loud "pop" each time I send a CW character and get more RX audio out of the volume knob, I'm also reading up on a mod for different tuning steps & even an LCD screen (for learning purposes only, really).  How does one actually connect to the processor to download/upload sketches to it? 

Does one connect to one of the un-pinned ports in the radio such as J6 or does the proc have to come out and sit on a burner type board?   I know just enough about Arduino programming to really make a mess but we have to start somewhere. 

Tnx in advance,

Ted
K3RTA


Colin Evans M1BUU
 

Hi Ted,
 
John is incorrect, the processor is an ATMEGA328 like you say, programmed via the Arduino environment.
 
The sketches are available via the Hilltopper groups.io reflector.
The easiest way to change the code in the chip would be to take the chip out of the radio and use an Arduino Uno with chip socket - some Unos use SMD processors, but a lot of the clones use DIP chips in a socket.
 
The Hilltopper chip will already have the bootloader on it, so once you've put it into an Uno, you can just upload the sketch via the Arduino IDE.
 
You could program the processor via J5, but you'd have to connect up the wires to an external programmer (or even an Arduino Uno).
 
If you join the Hilltopper group, you'll find more information.
 
73, Colin
M1BUU
 
Oh, I had a quick search and found this....
 


John Lonigro
 

Thanks, Colin.   I didn't realize the chip is an ATMEGA328.  In this case, the "PIC programmer" is just an UNO with a socketed chip, as Colin says.  I believe most of the rest of what I said is correct.  You don't want to try to download a program from a microprocessor.  If the sketches are available to download, you are good to go.  They are written in a higher level language and probably have lots of comments to boot (no pun intended).

72,

John, AA0VE

On 2/8/22 09:53, Colin Evans M1BUU wrote:

Hi Ted,
 
John is incorrect, the processor is an ATMEGA328 like you say, programmed via the Arduino environment.
 
The sketches are available via the Hilltopper groups.io reflector.
The easiest way to change the code in the chip would be to take the chip out of the radio and use an Arduino Uno with chip socket - some Unos use SMD processors, but a lot of the clones use DIP chips in a socket.
 
The Hilltopper chip will already have the bootloader on it, so once you've put it into an Uno, you can just upload the sketch via the Arduino IDE.
 
You could program the processor via J5, but you'd have to connect up the wires to an external programmer (or even an Arduino Uno).
 
If you join the Hilltopper group, you'll find more information.
 
73, Colin
M1BUU
 
Oh, I had a quick search and found this....
 


Jim Pruitt
 

Ted,

I would suggest that you talk to Lloyd (WA4EFS) about his LCD version of the code!  He is the one that provided the modified code that I am using to drive my Hilltopper20 with LCD display.  I modified his code slightly so I can pick the band I want to program.  It works very well.

As for programming the Hilltopper AVR (ATMega328P) it is actually pretty simple.  When I programmed that chip you are asking about I have a Ardunio Uno and I uploaded the "Example" sketch located in the Files then Examples then "ArduinoISP" the Arduino ISP sketch from the Arduino IDE and upload that to the Uno.  I then have a Arduino ISP like this one:
https://www.ebay.com/itm/253057569398

there are lots of ebay sellers selling them. Anyway with that sketch loaded into your Uno and the programming hat on the Uno then you can insert the new (or old) AVR (ATMega328P in 28 pin Dip package) into the Zif socket of that Arduino ISP programming hat (another name for plug in module) and load your Hilltopper code into the IDE and tell it to "Upload using programmer".  You will have needed to also tell it what the programmer was in the IDE.  At any rate you can also load the bootloader into the AVR (ATMega328P) before you load the Hilltopper code and the option to load bootloader is in the IDE file menu so it is easy but I use a separate thing from Canaduino:
https://universal-solder.ca/product/stand-alone-arduino-atmel-microchip-avr-atmega-boot-loader-programmer/

  It is a bootloader loader and was adapted by Canaduino (a Canadian seller on ebay and on the web and Amazon and https://universal-solder.ca/ ) from an Adafruit article. Anyway it is stand alone but needs power via a USB cable and all it does is load the bootloader onto a ATMega328P dip chip (it will not do any other chip) and takes about 5 seconds.  However,  you do not technically even need that bootloader.  By loading the bootloader you also set some fuses and that is the important piece.   In this case a "fuse" is nothing more than a computer program register setting.  The one that matters is the one telling the AVR to look for an oscillator but a particular one.  Ask me how I know about this!  If you take a bare AVR that has never had the bootloader loaded and never had anyone set the fuses then that AVR (ATmega328P) will look for the onboard 1 MHZ oscillator.  You know that has happened because the Hilltopper will spit out very raucous painfully show buzzes that if you had told it to find either the onboard 8mhz oscillator or an external oscillator then that sound would be the cw telling you what frequency it is on. Again ask me how I know this!  Anyway load the Hilltopper INO (sketch or program if you will) into the AVR (the ATMega328P chip from/for the Hilltopper) and then you can put that chip into the Hilltopper.  Do you need the Canaduino thing?  No.  You can do the same thing within the Arduino IDE. Because I am having to do a lot of them at a time it is easier for me.  When doing only 1 then the IDE is the easiest and cheapest way to go.

As someone suggested,  I would acquire another ATMega328P AVR chip to program and keep the one from your Hilltopper that I programmed in a safe place.  I realize that it might be hard to find a ATMega328P in 28 pin Dip from many suppliers right now. Also do not accidentally order the ATMEga328P in smt footprint. Even though it uses the same numbers as the Dip version the smt version has 32 pins where the Dip version only has 28 pins so be sure to get the right one.

As I think someone else mentioned in this thread the INO files for each of the 3 bands the 4SQRP sells of the Hilltopper are located in the Fiels section of theHilltopperkit subgroup of this one.  To subscribe to that sub group send a blank message to:

HilltopperKit+subscribe@4SQRP.groups.io
In the files section of that group are the Arduino IDE INO sketch files.  Because INO files are human readable you can look through it and see how things are done. You must be a member of this main group to join any of the 4SQRP sub groups and there is usually one for each kit currently being sold.

Now to veer slightly off course,  when you compile that INO (which it also does when you tell it to "upload using programmer") you can select to export that file and it will save a Hex file (machine code not very readable by humans) with bootloader and a file without bootloader.  Where it puts that file is often a mystery but the fact is that it does save it and with that you can use other programmers to put the binary and hex files on an AVR without having the Arduino IDE program.  It requires different programmers and a program to upload that hex file to the chip but that just complicates things for people not familiar with some of the various methods and tools for programming chips like the PIC and the AVR (both now owned by Atmel) and others from present and olden days (like the 8051 series or the 6500 and 6800 and others).

I hope I have not confused you with the above.

What is it that you are wanting to do with the Hilltopper and why you want to reprogram the AVR?

If you do charge off and add a LCD display to your Hilltopper like I have done be aware that the LCD will not fit into the existing case without modification.  I cut out the display hole and put mine on the top panel with the other controls but I now need side panels for the cabinet that are taller than the stock ones so the display with I2C driver does not short again parts on the main board.  Some others have also added the feature but they made it an external box. There is a row of empty holes (6 pin as I recall) that if you add the male headers the LCD plugs into it but has to be an I2C display.  Lloyd (WA4EFS) also had code for an OLED display but last time we talked about it he said it did not work that well.  With OLED displays it does not take up so much room.  I don't know if Lloyd worked on that any more.  I simply went with the LCD display.  At boot up (using WA4EFS file) the display shows my call for a couple seconds and then that never appears again until turned off and back on.

For anyone that did not see the announcement,  4SQRP is again selling the Hilltopper kits.

Thank you.

Jim Pruitt
WA7DUY



On 2/8/2022 7:52 AM, WA4EFS wrote:

The Hilltopper 20’s J5 connects to the MPU’s Tx, Rx, and reset pins. You can connect to J5 from an UNO board’s DIO 0, 1, ground and reset or alternatively using a USB-FTDI cable, but you do need the reset pin to program.  J6 is the i2c bus, which is not used for programming.

 

I recommend stashing the original ‘factory programmed’ MPU safely away in a drawer, and using a copy for experimenting.

 

73, -Lloyd (WA4EFS)

 

From: main@4SQRP.groups.io [mailto:main@4SQRP.groups.io] On Behalf Of Ted via groups.io
Sent: Tuesday, February 08, 2022 8:36 AM
To: main@4SQRP.groups.io
Subject: [4SQRP] Programming Arduino proc in Hilltopper-20

 

Hi, all.

While I try to whittle away at the loud "pop" each time I send a CW character and get more RX audio out of the volume knob, I'm also reading up on a mod for different tuning steps & even an LCD screen (for learning purposes only, really).  How does one actually connect to the processor to download/upload sketches to it? 

Does one connect to one of the un-pinned ports in the radio such as J6 or does the proc have to come out and sit on a burner type board?   I know just enough about Arduino programming to really make a mess but we have to start somewhere. 

Tnx in advance,

Ted
K3RTA