Silicon bug in Atmega2560?

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

Reply to
Meindert Sprang
Loading thread data ...

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

as

Reply to
Meindert Sprang

Meindert Sprang ha scritto:

Silicon bug ... in the AVRstudio simulator ?

regards

--
  lowcost
Reply to
lowcost

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

Meindert

Reply to
Meindert Sprang

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.

Reply to
Mike Harrison

I know that some of the

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

Meindert

Reply to
Meindert Sprang

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:

Reply to
AK

... 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]: 
 Click to see the full signature
Reply to
CBFalconer

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.