hassanmd
Member level 1
hi
i have used SPI on atmega16 with sd-card and it works fine. now i am shifted to 2560. the MASTER_INIT() function as describe in datasheet of 2560 , i used the same function. when i SIMULATE the code in avr-studio, the SPE ,MSTR and SPR0 is set. but as soon as program cursor step out side the initialization function and execute next instruction MSTR becomes 0.
it actually works something like a slave in real time on stk600. i am using avr studio 4.
on stk600 i continously checked the SPI transmit flag, it remain in that loop forever but as soon as i connect the SCK pin with open wire the flag turn high . in fact i am toggeling the LEd after that loop. also when i tried to check the waveform of SCK pin on oscilloscope and as soon as i connect the ground pin of osciloscop to the ground of STK600 it shows he same respose as with open wire.
plz help
i have used SPI on atmega16 with sd-card and it works fine. now i am shifted to 2560. the MASTER_INIT() function as describe in datasheet of 2560 , i used the same function. when i SIMULATE the code in avr-studio, the SPE ,MSTR and SPR0 is set. but as soon as program cursor step out side the initialization function and execute next instruction MSTR becomes 0.
it actually works something like a slave in real time on stk600. i am using avr studio 4.
on stk600 i continously checked the SPI transmit flag, it remain in that loop forever but as soon as i connect the SCK pin with open wire the flag turn high . in fact i am toggeling the LEd after that loop. also when i tried to check the waveform of SCK pin on oscilloscope and as soon as i connect the ground pin of osciloscop to the ground of STK600 it shows he same respose as with open wire.
plz help