zugzwang
Newbie level 4
Hello,
I am trying to log data via SPI to external flash with STM32F302VB.
(Winbond W25Q32FV)
I guess SPI section is OK, I tested it with logic analyzer and able to see the data I sent. There is no problem. But when I try to talk with flash, I see meaningless(irregular) values (like: 0xFF, 0xFF00, 0x00)
I've read the entire 100-page datasheet but I could not find a solution cuz I'm a beginner on this topic(communication/flash)
So, I want help with any kind of advice / sample / source you will do in this matter.
First of all, I tried to "Read Unique ID Number" Instruction:
![Flash_soru.PNG Flash_soru.PNG](https://www.edaboard.com/data/attachments/69/69543-b307d8c07b4c6fbfc51b8e62ea549bbb.jpg)
simply what I sent: (by the way, my spi_write function 8-bit)
spi_write(0x4B);
and 4 dummy bytes;
spi_write(0xAA); spi_write(0xBB); spi_write(0xCC); spi_write(0xDD);
and then read at same adress. But I get irregular values so i am confused
my write function is:
my read function is:
Thanks for any help.
I am trying to log data via SPI to external flash with STM32F302VB.
(Winbond W25Q32FV)
I guess SPI section is OK, I tested it with logic analyzer and able to see the data I sent. There is no problem. But when I try to talk with flash, I see meaningless(irregular) values (like: 0xFF, 0xFF00, 0x00)
I've read the entire 100-page datasheet but I could not find a solution cuz I'm a beginner on this topic(communication/flash)
So, I want help with any kind of advice / sample / source you will do in this matter.
First of all, I tried to "Read Unique ID Number" Instruction:
![Flash_soru.PNG Flash_soru.PNG](https://www.edaboard.com/data/attachments/69/69543-b307d8c07b4c6fbfc51b8e62ea549bbb.jpg)
simply what I sent: (by the way, my spi_write function 8-bit)
spi_write(0x4B);
and 4 dummy bytes;
spi_write(0xAA); spi_write(0xBB); spi_write(0xCC); spi_write(0xDD);
and then read at same adress. But I get irregular values so i am confused
my write function is:
Code:
void spi3_write(uint8_t data)
{
uint32_t spixbase = 0x00;
spixbase = (uint32_t)SPI3;
spixbase += 0x0C;
*(__IO uint8_t *)spixbase = data;
while(!(SPI3->SR & SPI_SR_TXE));
}
my read function is:
Code:
uint8_t spi3_read()
{
uint32_t spixbase = 0x00;
//while((SPI3->SR & SPI_SR_RXNE));
spixbase = (uint32_t)SPI3;
spixbase += 0x0C;
return *(__IO uint8_t *) spixbase;
}
Thanks for any help.