cancel
Showing results for 
Search instead for 
Did you mean: 

SPI FLASH read/write problem

megahercas6
Senior
Posted on July 21, 2013 at 13:50

Hello, i am making adsp-21488 spi flash programmer, and i run into some trublmes.

I use STM32F415 and using SPI1 (PA5/6/7) *** PB0 for communication with SPI. I can read Flash ID with no problem, and it's same as declared in pdf, so my spi is ok. but i can't do any read or write (maybe just write, since i read void data) I use different SPI flash as in example, but all commands, and timings are the same SST25VF016B in board, but example is for M25P64 Any idea why it's not write data correctly ? (It fails write, but pass in erase test) (if i run spi exaplme code, i get only first letter, all others are FF ) SPI init looks like this:

SPI_InitTypeDef SPI_InitStructure;
sFLASH_LowLevel_Init();
sFLASH_CS_HIGH();
SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex;
SPI_InitStructure.SPI_Mode = SPI_Mode_Master;
SPI_InitStructure.SPI_DataSize = SPI_DataSize_8b;
SPI_InitStructure.SPI_CPOL = SPI_CPOL_Low;
SPI_InitStructure.SPI_CPHA = SPI_CPHA_1Edge;
SPI_InitStructure.SPI_NSS = SPI_NSS_Soft;
SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_4;
SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB;
SPI_InitStructure.SPI_CRCPolynomial = 7;
SPI_Init(sFLASH_SPI, &SPI_InitStructure);
SPI_Cmd(sFLASH_SPI, ENABLE);


_legacyfs_online_stmicro_images_0690X00000604zb.png I don't know whats wrong, i spend all day trying to make it work, but in the end, it does not. I attached EWBARM project for some one to take a look Any help would be greait #m25p64-not-working-on-stm32f10e-
4 REPLIES 4
ipathan1114
Associate II
ipathan1114
Associate II
Posted on May 28, 2015 at 14:24

The original post was too long to process during our migration. Please click on the provided URL to read the original post. https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I6hV&d=%2Fa%2F0X0000000btW%2FnRlhIrip6bxaz.Mk.e.Hko8pRefctdXBqQx8qK_vvzM&asPdf=false
ipathan1114
Associate II
Posted on June 02, 2015 at 06:57

SPI M25P64 FLASH...WORKING CODE(MINE IS STM32F103 -EVAL BOARD.....CODE READS DEVICE ID ANDI WROTE ONE BYTE TO FLASH AND READ THE SAME..........JUST THAT ERASE FUNCTION I HV TO CHECK....BCOZ WE HV TO ERASE THAT BYTE WE WROTE AT 0X700000 LOCATION ELSE IT GIVES SAME BYTE READING...)  REMOVE ERASE FUNCTION......PROBLEM I FACED IS ...... JUSTT GIVE DELAY AFTER SPI INITIALIZATION........AND CHECK SLAVE SELECT PIN ..IT  SHOULD BE OUTPUT..AND OTHERS IN AF MODE.

ipathan1114
Associate II
Posted on June 29, 2015 at 07:53

GUYS ..SORRY ABOVE CODE CAN READ DEVICE ID CORRECTLY.....STILL READ WRITE IS NOT WORKING............  FOR READING DEVICE ID JUST CHECK IF UR SPI IS GETTING TIME TO INITIALIZE.....ADD DEALY OR  TAKE APPROPRIATE PRE SCALAR.......I WILL WORK OUT READING AND WRITTING SOON..