Silicon bug in Atmega2560?

May 14, 2009 7 Replies

Hi Guru's,



I have come across something weird. I have a bit of code on an Atmega2560 that does three things: is initialises two timers in CTC mode, it initialises the SPI port to talk to an SD card and it enables the SD card interface chip by setting PB5 high. This port pin is on the same port (B) as the SPI interface and the secondary function of this port pin is OC1A.



The following code initialises things:



void main( void ) { /* init SPI interface */ DDRB = (1


I can't believe noone has come across this besides me..... I got two responses on avrfreaks.net...

as

Meindert Sprang ha scritto:

Silicon bug ... in the AVRstudio simulator ?

regards

lowcost

Well, whatever you and I want to call it, the bug appears both on the processor and the simulator.

Meindert

It could well be that the simulator code is derived from the silicon HDL - I know that some of the earlier atmel IC's used the same HDL as the real silicon in an FPGA.

I know that some of the

My thoughts exactly. Which should make it easy for the guys at Atmel to find the bug....

Meindert

Hi,

in my opinion You forgot to initialize stack pointer. As soon as You call a function stack is used. If stack pointer is not set to correct RAM area, return from function will fail. What about interrupts handler ? I see You enable interrupts just before calling 'wait(3)' - are interrupts handlers defined ?

Best Regards AK

Meindert Sprang pisze:

... snip ...

What's the complaint? I would want the simulator to _accurately_ simulate the actual processor.

[mail]: Chuck F (cbfalconer at maineline dot net) [page]: Try the download section.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required