Electronics > Beginners
SPI Troubleshooting
Muffins:
Thanks guys, I got it ;D
Muffins:
Just one last note if anyone lands on this page through a search. To get the FRAM working you need to turn chip select on and off for each command. This is not apparent from the datasheet and had me stuck for an hour or two.
Example:
--- Code: --- data+=1;
PORTE &= ~(1 << 2); // chip select low
shiftOut(WREN);
PORTE |= (1 << 2); // chip select high
_delay_us(2);
PORTE &= ~(1 << 2);
shiftOut(write);
shiftOut(addressHigherByte);
shiftOut(addressLowerByte);
shiftOut(data);
PORTE |= (1 << 2);
--- End code ---
HwAoRrDk:
--- Quote from: Muffins on January 28, 2020, 11:21:30 am ---Just one last note if anyone lands on this page through a search. To get the FRAM working you need to turn chip select on and off for each command. This is not apparent from the datasheet and had me stuck for an hour or two.
--- End quote ---
Well... to be fair, not really. Chip select (CS) is mentioned in that Fujitsu datasheet in many places, and illustrated in all the timing diagrams. The pin description table even specifically says "CS has to be āLā before inputting op-code".
It always pays to read the datasheet for a part thoroughly before using it. Half an hour studying the datasheet beforehand can save several hours of confusion later. :)
hermitengineer:
To be more precise, CS must go low before inputting a command, and must be raised to end a command. Operations such as READ and WRITE can be optimized by holding CS low for multiple bytes read or written to contiguous memory.
mikerj:
--- Quote from: Muffins on January 28, 2020, 11:21:30 am ---Just one last note if anyone lands on this page through a search. To get the FRAM working you need to turn chip select on and off for each command. This is not apparent from the datasheet and had me stuck for an hour or two.
--- End quote ---
This isn't something specific to your FRAM device, pretty much all SPI peripherals work like this. Every timing diagram in the FRAM datasheet shows the required behaviour of the CS line.
Navigation
[0] Message Index
[*] Previous page
Go to full version