MEGA2560 and LCD problem

  • 1
  • 2
  • Seite 2 von 2
Merlin
Administrator
Avatar
Geschlecht:
Alter: 25
Beiträge: 1474
Dabei seit: 03 / 2005
Betreff:

Re: MEGA2560 and LCD problem

 · 
Gepostet: 14.11.2016 - 14:03 Uhr  ·  #9
Hi Marek.

I don't have suitable hardware available - sorry. But I can give some general guidelines on using the debugger. First put a Debug_Break; line just before the Write statement. Compile and install to your hardware, and using your dongle as debugger run the hardware until the breakpoint is reached. Click the ASM button and use F7 to step into the code. Keep your source code to hand. The registers you are interested in are _ACCCLO and _ACCCHI which should start at zero, then as you hit the line after SYSTEM._L0048: for the first time they should be zero and 1, and the second time zero and 2, and so on. A couple of lines later, after the ELPM statement has executed, the value in _ACCA should be ASCII code for 'A' then 'B' then 'C'. I expect the _ACCA register, from what you describe, to be 'A' then $FF, but why is not clear. If the _ACCCLO and _ACCCHI registers are not as expected, then that is the are to examine next. If all the registers (including _ACCA) are as expected, then we need to look at some sort of hardware incompatibility - maybe some timing issues or something like that, but we will have at least eliminated the main software (or not).
rh
Administrator
Avatar
Geschlecht:
Herkunft: Germany
Alter: 25
Homepage: e-lab.de
Beiträge: 5558
Dabei seit: 03 / 2002
Betreff:

Re: MEGA2560 and LCD problem

 · 
Gepostet: 14.11.2016 - 14:19 Uhr  ·  #10
Hello Merlin,
sorry, the AVRco SIM/ICE doesn´t support in-hardware debugging of the Mega256
because Atmel did not publish the necessary debug extensions for the 256kB Mega
devices. With the XMega types there is no difference, here the ICE works always.
The only way to debug in a Mega256 hardware is to use the Atmel JTAG ICE.

rolf
Merlin
Administrator
Avatar
Geschlecht:
Alter: 25
Beiträge: 1474
Dabei seit: 03 / 2005
Betreff:

Re: MEGA2560 and LCD problem

 · 
Gepostet: 14.11.2016 - 15:04 Uhr  ·  #11
Ah - I stand corrected Rolf.
Merlin
Administrator
Avatar
Geschlecht:
Alter: 25
Beiträge: 1474
Dabei seit: 03 / 2005
Betreff:

Re: MEGA2560 and LCD problem

 · 
Gepostet: 14.11.2016 - 15:19 Uhr  ·  #12
@Marek, @Rolf

This smells to me of a defect in the chip. Looking at the differenced in the code and the scope outputs, it suggests that ICALL works, but EICALL doesn't work properly, or that OUT EIND doesn't work consistently (maybe problem after IN EIND in timer routine?)
rh
Administrator
Avatar
Geschlecht:
Herkunft: Germany
Alter: 25
Homepage: e-lab.de
Beiträge: 5558
Dabei seit: 03 / 2002
Betreff:

Re: MEGA2560 and LCD problem

 · 
Gepostet: 14.11.2016 - 16:49 Uhr  ·  #13
Hello Merlin,
I also thought of a chip defect.
But strange, the same chip obviously works when programmed as a Mega640/128.
Maybe you are right with these extended registers.
But the OP claims that programming the same chip with C it works.
:aerger:
Absolutely strange.

rolf
Merlin
Administrator
Avatar
Geschlecht:
Alter: 25
Beiträge: 1474
Dabei seit: 03 / 2005
Betreff:

Re: MEGA2560 and LCD problem

 · 
Gepostet: 14.11.2016 - 17:53 Uhr  ·  #14
It is precisely because it works when programmed as a MEGA640/128 that I thought of that. The only differences relate to the use of EIND and ICALL vs EICALL (and of course the ROM Page where the string is stored). The fact that the C code works though, is interesting. It depends on how the code is generated/optimised. I wonder if the ASM it generates is available?
Harald_K
 
Avatar
 
Betreff:

Re: MEGA2560 and LCD problem

 · 
Gepostet: 14.11.2016 - 19:30 Uhr  ·  #15
might it be that programming of the lock bits is the problem??

i found in the 2560-datasheet that you can inhibit reading of some ROM-areas with the (E)LPM instruction.

the lock bits in the sample program are not defined, so it might be that the prommer uses the definition of the last project ...
Merlin
Administrator
Avatar
Geschlecht:
Alter: 25
Beiträge: 1474
Dabei seit: 03 / 2005
Betreff:

Re: MEGA2560 and LCD problem

 · 
Gepostet: 15.11.2016 - 09:08 Uhr  ·  #16
Hi Harold. Looking through the data sheet I cannot see this reference except in relation to bootloader. The application source does not implement a bootloader, so I suppose if the fuse bits are set to reserve the bootloader area this is theoretically possible. But then I would not expect the first character emitted either.
  • 1
  • 2
  • Seite 2 von 2
Gewählte Zitate für Mehrfachzitierung:   0

Registrierte in diesem Topic

Aktuell kein registrierter in diesem Bereich

Die Statistik zeigt, wer in den letzten 5 Minuten online war. Erneuerung alle 90 Sekunden.
MySQL Queries: 15 · Cache Hits: 14   135   149 · Page-Gen-Time: 0.032799s · Speichernutzung: 2 MB · GZIP: ein · Viewport: SMXL-HiDPI