2
\$\begingroup\$

I've got an AT90CAN128 I'm trying to program with an Atmel ICE using a .hex file consisting of a bootloader and application code.

I can erase the flash, write fuse values and write to the eeprom just fine - or at least without any error messages, but when I try to write to the flash, the operation just times out after a while. I tried increasing the timeout to 10mins, but there was no change.

I am confident that the .hex file is not the issue as we successfully used it a few months ago and its "last modified" date predates that.

I have tried setting the fuses to allow serial programming, with no change.

What else should I be looking at?

Our programming process looks like

atprogram -t atmelice -i ISP -d at90can128 chiperase
atprogram -t atmelice -i ISP -d at90can128 program -fl -f "8000-00815-01_S_with_Bootloader.hex" --verify
atprogram -t atmelice -i ISP -d at90can128 program -ee -f "8000-00901-01_C.hex"  --verify
atprogram -t atmelice -i ISP -d at90can128 write -fs --values FFF0FD

But it just sits and spins at the first programming step, and eventually times out.

I've tried adding the -xr and --timeout 600 flags. I also tried running all the other commands, and they all succeeded.

Further info from comments:

It appears that I can successfully read from the flash using atprogram -t atmelice -i ISP -d at90can128 read -fl -s 1024, which gives me a bunch of 0xff bytes. Running a similar command with the -ee switch confirms the eeprom is being written correctly.

If I disconnect the MCU, all the commands fail with a completely different error message.

Further, I have discovered I can program something onto the MCU using Microchip Studio, but that is not practical for use long term.

\$\endgroup\$
9
  • 1
    \$\begingroup\$ I can erase the flash ... how do you know this? \$\endgroup\$
    – jsotola
    Dec 12, 2022 at 21:25
  • \$\begingroup\$ @jsotola The chiperase command succeeds, without any errors. Is that not what that command does? \$\endgroup\$
    – RoadieRich
    Dec 12, 2022 at 21:32
  • \$\begingroup\$ @jsotola I'm new to embedded systems, so I apologise if my terminology is incorrect. \$\endgroup\$
    – RoadieRich
    Dec 12, 2022 at 21:35
  • \$\begingroup\$ I am not personally familiar with the system you are using... so my assumption is that if a function fails, then all functions fail, unless proven otherwise ... does chiperase fail if the AT90CAN128 is not connected? ... does chiperase have a -verify option available? \$\endgroup\$
    – jsotola
    Dec 12, 2022 at 21:59
  • \$\begingroup\$ @jsotola chiperase (and the other commands) fail with a completely different message if the IC is not connected, and there is no --verify option available on that command. \$\endgroup\$
    – RoadieRich
    Dec 13, 2022 at 13:16

2 Answers 2

0
\$\begingroup\$

I can suspect some things, but no without additional information. Since you can read the flash or eeprom, there is an issue with programming only so:

  1. What is your programming hookup? What -other than the MCU- components does your PCB has? Things like pull up resistor on the reset signal, capacitors close to the IC, what is the cable and cable length used for programming? Larger cable length with no shielding = more noise on the programming lines.

  2. What frequency are you trying to program it? Lower frequencies work better if your cables are long and non-shielded. Also try to program the board outside of the chassis, as the chassis might not be grounded correctly and might fail programming it.

changing atmel ice programming speed

  1. Can you show us the tracks of the programming method? Do these tracks go to other ICs on the PCB? For example if you program the Board via ISP, then the SPI lines might also lead to another SPI IC on your board, and it might interfere with the programming process as it tries to respond to the programming signals:

schematic

simulate this circuit – Schematic created using CircuitLab

Even if you do not have the SPI IC soldered on the board, the tracks that lead to it might cause reflections on the signal lines.

  1. Do you have the latest firmware on your atmel ICE? On windows, you can update to the latest firmware on atmel ICE, if you have installed the latest Microchip studio, it will ask you to update it the first time you plug it in. The only pic I can find for it:

update atmel ice
from here

I am confident that the .hex file is not the issue as we successfully used it a few months ago and its "last modified" date predates that.

  1. Did you try upload an empty .hex file? (only an empty main() function compiled). Also, you mention you modified the code/hex file. If you program the IC via SPI, then try disable the initiation/configuration of the SPI in your code, since it might try to send/receive data on the SPI line while the Atmel ice tries to program it, and it fails.

  2. Is your PCB clean from flux residues? Usually acetone instead of isopropanol can clean the PCB deeper with less need of rubbing. I had issues where I could not program my IC via Atmel ICE due to dirty PCB.

Last but not least, your IC might is defective or got burned during soldering. Have you tried re-soldering the IC? can we see a picture of your board?

\$\endgroup\$
4
  • \$\begingroup\$ I have discovered I can program something (it fails EOL tests after final assembly) onto the MCU using Microchip Studio, but that is not practical for use long term. Does that give any further clue as to what's happening at the command line? \$\endgroup\$
    – RoadieRich
    Apr 13 at 21:13
  • \$\begingroup\$ Come again, you can program the MCU before you solder all the components on the PCB? (And by 'EOL' you mean mean end of life?) Didnt quite get that \$\endgroup\$ Apr 15 at 15:03
  • \$\begingroup\$ EOL = end of line, and I took the part I was trying to program through the command line, and was able to load something into the mcu through the Microchip Studio IDE, it just fails the tests we put it through after final assembly. It looks like it boot loops on startup. \$\endgroup\$
    – RoadieRich
    Apr 15 at 19:39
  • \$\begingroup\$ "load something into the mcu" what does that mean? What did you manage to load? What kind of tests fails at final assembly? does it pass these tests before final assembly? \$\endgroup\$ Apr 18 at 7:54
0
\$\begingroup\$

Possible things to try:

  1. Setting a logfile (-l filename), perhaps it will give you more information
  2. The clock frequency -cl 10 MHz, perhaps it needs to be slower
  3. Try another individual part
  4. Consider the alternative programmer avrdude, perhaps with its -B nnn 5etting to control the bit clock.
  5. Consider an alterative programming device, in order to rule out this Atmel ICE. (Perhaps a Raspberry Pi or Arduino if you have one in the lab.)

atprogram manual

\$\endgroup\$
3
  • \$\begingroup\$ I have discovered I can program something (it fails EOL tests after final assembly) onto the MCU using Microchip Studio, but that is not practical for use long term. Does that give any further clue as to what's happening at the command line? \$\endgroup\$
    – RoadieRich
    Apr 13 at 21:13
  • \$\begingroup\$ Could you clarify whether it is one individual chip you can't program? Or any of these parts? \$\endgroup\$
    – jonathanjo
    Apr 14 at 7:16
  • \$\begingroup\$ I've only got two parts to test with, one is known to be good, the other new. Neither would program from the command line. \$\endgroup\$
    – RoadieRich
    Apr 14 at 16:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.