MEGA2560 and LCD problem

  • 1
  • 2
  • Page 2 of 2
Merlin
Administrator
Avatar
Gender:
Age: 24
Posts: 1409
Registered: 03 / 2005
Subject:

Re: MEGA2560 and LCD problem

 · 
Posted: 14.11.2016 - 14:03  ·  #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
Gender:
Location: Germany
Age: 24
Homepage: e-lab.de
Posts: 5558
Registered: 03 / 2002
Subject:

Re: MEGA2560 and LCD problem

 · 
Posted: 14.11.2016 - 14:19  ·  #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
Gender:
Age: 24
Posts: 1409
Registered: 03 / 2005
Subject:

Re: MEGA2560 and LCD problem

 · 
Posted: 14.11.2016 - 15:04  ·  #11
Ah - I stand corrected Rolf.
Merlin
Administrator
Avatar
Gender:
Age: 24
Posts: 1409
Registered: 03 / 2005
Subject:

Re: MEGA2560 and LCD problem

 · 
Posted: 14.11.2016 - 15:19  ·  #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
Gender:
Location: Germany
Age: 24
Homepage: e-lab.de
Posts: 5558
Registered: 03 / 2002
Subject:

Re: MEGA2560 and LCD problem

 · 
Posted: 14.11.2016 - 16:49  ·  #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
Gender:
Age: 24
Posts: 1409
Registered: 03 / 2005
Subject:

Re: MEGA2560 and LCD problem

 · 
Posted: 14.11.2016 - 17:53  ·  #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
 
Subject:

Re: MEGA2560 and LCD problem

 · 
Posted: 14.11.2016 - 19:30  ·  #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
Gender:
Age: 24
Posts: 1409
Registered: 03 / 2005
Subject:

Re: MEGA2560 and LCD problem

 · 
Posted: 15.11.2016 - 09:08  ·  #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
  • Page 2 of 2
Selected quotes for multi-quoting:   0

Registered users in this topic

Currently no registered users in this section

The statistic shows who was online during the last 5 minutes. Updated every 90 seconds.
MySQL Queries: 15 · Cache Hits: 14   135   149 · Page-Gen-Time: 0.035838s · Memory Usage: 2 MB · GZIP: on · Viewport: SMXL-HiDPI