AVR tiny 416 SPI SSD not working

Thread Starter

Daniel Morley Jack

Joined Dec 5, 2019
4
I am trying to use SPI to talk to a 25R3911b to get it to read a register with a SPI right command 0x42. To read the register at 02 address. The function gives the right address on the MOSI line but the chip select goes high and I cannot figure out why.
void Comand25r3911b (uint8_t commandaddress, uint8_t data )
{
uint8_t TEMP;
TEMP=commandaddress;

SPI_0_write_block(&TEMP,1);


TEMP=data;


SPI_0_write_block(&TEMP,1);


}
 

Attachments

Thread Starter

Daniel Morley Jack

Joined Dec 5, 2019
4
Ignore previous code

void Read25r3911b (uint8_t commandaddress)
{ uint8_t data;
uint8_t TEMP;
TEMP=commandaddress;

PORTC_set_pin_level(3,low);

SPI_0_write_block(&TEMP,1);

PORTC_set_pin_level(3,high);



// SPI_0_read_block(&TEMP,1);


}
 

Thread Starter

Daniel Morley Jack

Joined Dec 5, 2019
4
void Read25r3911b (uint8_t commandaddress)
{ uint8_t data;
uint8_t TEMP;
TEMP=commandaddress;

PORTC_set_pin_level(3,low);

SPI_0_write_block(&TEMP,1);
while (SPI_0_status_busy()); //1





SPI_0_read_block(&TEMP,1);
//PORTC_set_pin_level(3,high);

while (SPI_0_status_busy());

}

This version of the code never gets out of comment 1
 
Top