atmega2560 - LTC2440 SPI communication...need help troubleshooting

New guy here trying to talk to an AD board via SPI. Was hoping someone might help me troubleshoot.

I have an ATmega2560 attached to a STK600 development board. I'm trying to get data off of a LTC2440cgn AD board. But all I get out is 0...

The AD board is 24 bit resolution, but produces a 32 bit value with the data being in bits 5-28... so I figure first I need to read in 4 bytes from the AD via SPI. Then I combine 4 those four bytes into one and peel off the data bits. Then I send the 8 most significant bits to LEDs to see if I'm getting anything.

Here is my function to initialize the SPI...

void InitSPI(void) { //SPI is done through PORTB. SS is pin0, SCK is pin1, MOSI is pin2 DDRB = (1

Reply to
icabod8
Loading thread data ...

g to

om

f

if

MOSI is pin2

I need this?

=A0 =A0//data bits are 5-28

t

ta

n

to test output

w Loop is executing

Just one thing i can think of, but might not be the problem. SS is not automatic in SPI master mode. Might want to add PORTB |=3D (1

Reply to
linnix

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.