Welcome
Username or Email:

Password:


Missing Code




[ ]
[ ]
Online
  • Guests: 31
  • Members: 0
  • Newest Member: omjtest
  • Most ever online: 396
    Guests: 396, Members: 0 on 12 Jan : 12:51
Members Birthdays:
One birthday today, congrats!
Colin 99 (53)


Next birthdays
05/14 hvguy (41)
05/14 thehappyelectron (14)
05/14 Justin (2024)
Contact
If you need assistance, please send an email to forum at 4hv dot org. To ensure your email is not marked as spam, please include the phrase "4hv help" in the subject line. You can also find assistance via IRC, at irc.shadowworld.net, room #hvcomm.
Support 4hv.org!
Donate:
4hv.org is hosted on a dedicated server. Unfortunately, this server costs and we rely on the help of site members to keep 4hv.org running. Please consider donating. We will place your name on the thanks list and you'll be helping to keep 4hv.org alive and free for everyone. Members whose names appear in red bold have donated recently. Green bold denotes those who have recently donated to keep the server carbon neutral.


Special Thanks To:
  • Aaron Holmes
  • Aaron Wheeler
  • Adam Horden
  • Alan Scrimgeour
  • Andre
  • Andrew Haynes
  • Anonymous000
  • asabase
  • Austin Weil
  • barney
  • Barry
  • Bert Hickman
  • Bill Kukowski
  • Blitzorn
  • Brandon Paradelas
  • Bruce Bowling
  • BubeeMike
  • Byong Park
  • Cesiumsponge
  • Chris F.
  • Chris Hooper
  • Corey Worthington
  • Derek Woodroffe
  • Dalus
  • Dan Strother
  • Daniel Davis
  • Daniel Uhrenholt
  • datasheetarchive
  • Dave Billington
  • Dave Marshall
  • David F.
  • Dennis Rogers
  • drelectrix
  • Dr. John Gudenas
  • Dr. Spark
  • E.TexasTesla
  • eastvoltresearch
  • Eirik Taylor
  • Erik Dyakov
  • Erlend^SE
  • Finn Hammer
  • Firebug24k
  • GalliumMan
  • Gary Peterson
  • George Slade
  • GhostNull
  • Gordon Mcknight
  • Graham Armitage
  • Grant
  • GreySoul
  • Henry H
  • IamSmooth
  • In memory of Leo Powning
  • Jacob Cash
  • James Howells
  • James Pawson
  • Jeff Greenfield
  • Jeff Thomas
  • Jesse Frost
  • Jim Mitchell
  • jlr134
  • Joe Mastroianni
  • John Forcina
  • John Oberg
  • John Willcutt
  • Jon Newcomb
  • klugesmith
  • Leslie Wright
  • Lutz Hoffman
  • Mads Barnkob
  • Martin King
  • Mats Karlsson
  • Matt Gibson
  • Matthew Guidry
  • mbd
  • Michael D'Angelo
  • Mikkel
  • mileswaldron
  • mister_rf
  • Neil Foster
  • Nick de Smith
  • Nick Soroka
  • nicklenorp
  • Nik
  • Norman Stanley
  • Patrick Coleman
  • Paul Brodie
  • Paul Jordan
  • Paul Montgomery
  • Ped
  • Peter Krogen
  • Peter Terren
  • PhilGood
  • Richard Feldman
  • Robert Bush
  • Royce Bailey
  • Scott Fusare
  • Scott Newman
  • smiffy
  • Stella
  • Steven Busic
  • Steve Conner
  • Steve Jones
  • Steve Ward
  • Sulaiman
  • Thomas Coyle
  • Thomas A. Wallace
  • Thomas W
  • Timo
  • Torch
  • Ulf Jonsson
  • vasil
  • Vaxian
  • vladi mazzilli
  • wastehl
  • Weston
  • William Kim
  • William N.
  • William Stehl
  • Wesley Venis
The aforementioned have contributed financially to the continuing triumph of 4hv.org. They are deserving of my most heartfelt thanks.
Forums
4hv.org :: Forums :: Computer Science
« Previous topic | Next topic »   

SPI FLASH problem

1 2 
Move Thread LAN_403
Linas
Sun Jul 21 2013, 11:17AM Print
Linas Registered Member #1143 Joined: Sun Nov 25 2007, 04:55PM
Location: Vilnius, Lithuania
Posts: 721
Hello, i am making ADSP FLASH programmer, all stuff is done, now flash programing stooping me from succeeding mad

STM32F4 is connected via SPI1 to flash. I can read ID from flash ( and yes, it is perfect match in pdf), and read status register, and write status register. so my guess SPI bus is ok.
But i can't write, and read any data.
ok, first what i do, is set register to 0x00 ( aka write protection is disabled)

sFLASH_WriteEnable();
sFLASH_CS_LOW();
sFLASH_SendByte(0x01);
sFLASH_SendByte(0x00);

nest i do all flash erase
void sFLASH_EraseBulk(void)
{
/*!< Send write enable instruction */
sFLASH_WriteEnable();
/*!< Select the FLASH: Chip Select low */
sFLASH_CS_LOW();
/*!< Send Bulk Erase instruction */
sFLASH_SendByte(sFLASH_CMD_BE);
/*!< Deselect the FLASH: Chip Select high */
sFLASH_CS_HIGH();
/*!< Wait the end of Flash writing */
sFLASH_WaitForWriteEnd();
}

writing data like this:
int i = 0;
while(i<256)
{
sFLASH_Write_Char(i,i);
i++;
}

void sFLASH_Write_Char(uint8_t data, uint32_t ReadAddr)
{
sFLASH_CS_LOW();

sFLASH_SendByte(sFLASH_CMD_WRITE);

sFLASH_SendByte((ReadAddr & 0xFF0000) >> 16);

sFLASH_SendByte((ReadAddr& 0xFF00) >> 8);

sFLASH_SendByte(ReadAddr & 0xFF);

SPI_I2S_SendData(sFLASH_SPI, data);

sFLASH_CS_HIGH();

sFLASH_WaitForWriteEnd();
}

Do i mist something ?
Back to top
Erlend^SE
Sun Jul 21 2013, 08:49PM
Erlend^SE Registered Member #1565 Joined: Wed Jun 25 2008, 09:08PM
Location: Norway
Posts: 159
Maybe you could tell what flash chip?

programming voltage?

How do you know you can't read/write data?
Back to top
Linas
Sun Jul 21 2013, 09:12PM
Linas Registered Member #1143 Joined: Sun Nov 25 2007, 04:55PM
Location: Vilnius, Lithuania
Posts: 721
Erlend^SE wrote ...

Maybe you could tell what flash chip?
programming voltage?
How do you know you can't read/write data?
Link2
it should work on 3.3v
void sFLASH_Read(uint8_t* pBuffer, uint32_t ReadAddr, uint16_t NumByteToRead)
{
sFLASH_CS_LOW();

sFLASH_SendByte(0x03);
sFLASH_SendByte((ReadAddr & 0xFF0000) >> 16);

sFLASH_SendByte((ReadAddr& 0xFF00) >> 8);

sFLASH_SendByte(ReadAddr & 0xFF);

while (NumByteToRead--)
{
*pBuffer =sFLASH_SendByte(sFLASH_DUMMY_BYTE); //sFLASH_SendByte(sFLASH_DUMMY_BYTE);
pBuffer++;
}
sFLASH_CS_HIGH();
}

void sFLASH_Write_Char(uint8_t data, uint32_t ReadAddr)
{
sFLASH_CS_LOW();

sFLASH_SendByte(0x06);

sFLASH_CS_HIGH();

sFLASH_CS_LOW();

sFLASH_SendByte(0x02);

sFLASH_SendByte((ReadAddr & 0xFF0000) >> 16);

sFLASH_SendByte((ReadAddr& 0xFF00) >> 8);

sFLASH_SendByte(ReadAddr & 0xFF);

SPI_I2S_SendData(sFLASH_SPI, data);

sFLASH_CS_HIGH();

}

i do bulk erase. Than set status registers to zeros. and write simple countng up data., when i try to read it, i can't find any data, just FF
Back to top
Conundrum
Mon Jul 22 2013, 07:43AM
Conundrum Registered Member #96 Joined: Thu Feb 09 2006, 05:37PM
Location: CI, Earth
Posts: 4059
Indadequate voltage?
Also worth checking, pull-up resistors and timing; if the signals are not square then the chip might not be inputting the data correctly.

-A
Back to top
Linas
Mon Jul 22 2013, 08:06AM
Linas Registered Member #1143 Joined: Sun Nov 25 2007, 04:55PM
Location: Vilnius, Lithuania
Posts: 721
Conundrum wrote ...

Indadequate voltage?
Also worth checking, pull-up resistors and timing; if the signals are not square then the chip might not be inputting the data correctly.
I hape pullup to CS,WP,HD, and using PP Output in mcu, and i have local DC/DC to 3.30V.Somehow i can read chip id, but if i try to write data, i read nothing.
(Or, i don't know how to read, or how to write)
probing show excellent timings frown
As always, if i made hardware right, software start to not work, and vice versa dead

lol, changed flash to EPCS4 and it worked in first time.
So i ordered new flash, and problem should be solved.
Back to top
Erlend^SE
Mon Jul 22 2013, 05:38PM
Erlend^SE Registered Member #1565 Joined: Wed Jun 25 2008, 09:08PM
Location: Norway
Posts: 159
Check the other chip again, maybe it needs some programming voltage (around 12V?)

It's always a good idea to tell the name of the part that doesn't work/seem to work.
Back to top
Linas
Mon Jul 22 2013, 05:51PM
Linas Registered Member #1143 Joined: Sun Nov 25 2007, 04:55PM
Location: Vilnius, Lithuania
Posts: 721
Erlend^SE wrote ...

Check the other chip again, maybe it needs some programming voltage (around 12V?)

It's always a good idea to tell the name of the part that doesn't work/seem to work.
Link2
Back to top
Linas
Wed Jul 24 2013, 09:22AM
Linas Registered Member #1143 Joined: Sun Nov 25 2007, 04:55PM
Location: Vilnius, Lithuania
Posts: 721
OK, i realy ned some one who knows how to work with SPI FLASH.
Right now i am using EPCS16 from my fpga board.

If i delete sector, and fill with data, i can read it with no problem. But if i try just to read flash from power-up,i get void data. (Yes, flash was programed, but not deleted)

Same problem is with dsp booting, i don't get any activity from MISO pi, only high state, and yes was successfully write.

To write flash i use simple function, so no error can be write into flash:
while( TransferStatus == FAILED)
{
sFLASH_EraseSector(sk);
sFLASH_WriteBuffer(Tx_Buffer,sk,256);
sFLASH_ReadBuffer(Rx_Buffer, sk, 256);
TransferStatus = Buffercmp(Tx_Buffer, Rx_Buffer, 256);//return PASSED if Rx and Tx data is the same, sk is address
}
TransferStatus=FAILED; //so next time when i have full buffer, i will go to this loop

Do i missing something ? do i need to write some registers or what ? why if i execute page delete and fill it with data i can read it, but if i try just to read after powerup (and some delay), i get nothing ?
Back to top
Steve Conner
Wed Jul 24 2013, 10:41AM
Steve Conner Registered Member #30 Joined: Fri Feb 03 2006, 10:52AM
Location: Glasgow, Scotland
Posts: 6706
I deal with problems like this all the time at work. The solution is lots of hard work with a scope and logic analyser plus reading the datasheets of all the parts 100 times. (including any errata that the manufacturer might have published later)

Even if the flash was full of garbage data, or blank, or not connected at all, I'd expect the DSP to attempt to read it at boot time. It should clock in the first 1000 or so words, try to execute it as code, and if the data is bad it will crash at this point.

So it sounds like you have two problems here: your flash write routine on the STM32 is broken and your DSP boot mode is configured wrongly. (or it's not trying to boot because it's lacking some power rail or clock signal)

The EPCS16 is meant for configuring Altera FPGAs. Is it even compatible with the DSP's SPI bootloader?

Finally I noticed this in the EPCS series datasheet:
wrote ...
For write and erase operations, drive the nCS pin high at a byte boundary that is in a
multiple of eight clock pulses. Otherwise, the operation is rejected and not executed.
Back to top
Linas
Wed Jul 24 2013, 12:26PM
Linas Registered Member #1143 Joined: Sun Nov 25 2007, 04:55PM
Location: Vilnius, Lithuania
Posts: 721
OK, this is just me beeing stupid as always.
I was writing to buffer, not page, and when i switched to page, and after chip erase setting all registers to zero, worked as it should. So yes, you must know your enemy. ill

Anyway, ADSP-21488 still doesn't want to work, i can see now some activity on all pins (MOSI give just read command as it should, and MISO just readouts all data from flash, cs goes low for eternity)

Is always fun to start to work from hardest point with new technology... (ADSP i mean)
Back to top
1 2 

Moderator(s): Chris Russell, Noelle, Alex, Tesladownunder, Dave Marshall, Dave Billington, Bjørn, Steve Conner, Wolfram, Kizmo, Mads Barnkob

Go to:

Powered by e107 Forum System
 
Legal Information
This site is powered by e107, which is released under the GNU GPL License. All work on this site, except where otherwise noted, is licensed under a Creative Commons Attribution-ShareAlike 2.5 License. By submitting any information to this site, you agree that anything submitted will be so licensed. Please read our Disclaimer and Policies page for information on your rights and responsibilities regarding this site.