Help ATmega128 and AT45DB081D problems

Go To Last Post
15 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi all, I am new to this forum so go easy on me!

I have an issue with some atmel at45db081d dataflash that I am trying to solve. I have migrated from using the AT45DB081B which has gone obsolete. But I just cannot seem to get the D version working correctly!

I am connecting to the flash via spi from the ATmega 128 in mode 0. I am using long established software routines that worked well with the old B version of the chip

I am just doing a simple read of the manufacturing ID and I get the following 4 bytes back 0x1f,0x50,0x00,0x00. The data sheet says it should be 0x1f, 0x25,0x00,0x00. Also reads of the status register normally give me 0xaa but from the data sheet bits5-2 of the status reg are a density code of 1001 so it is not possible to read 0xaa from the dataflash. Consequently memory reads and writes dont work!
I am sure the wiring is correct as I have checked on a scope and if I had it wrong I would not get any values out. please help!!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Welcome to the Forum.
Is the supply voltage you are using correct for the D version.

Charles Darwin, Lord Kelvin & Murphy are always lurking about!
Lee -.-
Riddle me this...How did the serpent move around before the fall?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am running the dataflash from a 3.0V rail.
The old version (AT45DB081B) was 20Mhz max but the AT45DB081D is up to 66Mhz. I wonder if ringing on SCK could be the issue?
The SCK also goes to 2 ADCs (ADS7822) so its maybe 15-20m trace?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Have a good look at the relevant data sheets for any obvious timing differences. Did you write the original code for the AT45DB081B?

Charles Darwin, Lord Kelvin & Murphy are always lurking about!
Lee -.-
Riddle me this...How did the serpent move around before the fall?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No I didnt write the original code but it is fairly simple and uses the on chip spi not bit-banged ports. Essentially it is doing this:

start transmission by writing char to SPDR
poll SPIF until complete
read SPDR to get dataflash response

I am pretty sure its not the code as it works fine with the B-type flash.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

HEY have you solved this  flash problem coz i have same problem like you. i have to replace flash memory IC AT45DB081E instead of AT45DB081D. and system clock frequency is different in this two IC. one have 66MHz and another has 85MHz. and i don't know what kind of changes are required for this new IC.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I doubt you'll get a reply.  If you would take a moment to look, you'd see that the original poster (OP) hasn't made a single post here in over five years.

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"Read a lot.  Write a lot."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

riddhi patel Consider the thread successfully hijacked.

 

I successfully upgraded to Revision-D silicon some years ago. It worked first time (mostly). Unfortunately I cannot remember the detail of what I had to change but I do re-collect an Atmel document on the changes required. Atmel (foolishly perhaps) sold that whole product line to a company whose name eludes me - but it sounded like Steptoe (as in Steptoe & Son).

 

My recommendations from looking over some old source:

  1. Ignore the speed difference. I did. The humble AVR wont stress the part at all.
  2. Take note of the sleep feature in the data sheet
  3. Take note of the start-up delay.

 

Here's some code:

//DataFlash Commands for Revision-D Silicon
#define DEVICEIDREAD 0x9F //Manufacturer and Device ID Read
#define DEEPPOWERDOWN 0xB9
#define DEEPPOWERWAKE 0xAB

static bool bAT45revD;					//DataFlash Device Revision.

/Init DataFlash Module
//---------------------------------------------------------------
void DataFlashInit (void)
{
bAT45revD=true; //Assume Revision-D chip
DataFlashWake();

for (uint8_t i=35;  i!=0;  i--) _NOP();	//Trdpd=35us from Atmel Datasheet.

if (!IsRevisionD())
    bAT45revD=false;
}

//Start a DataFlash Session. Wake from Sleep.
//---------------------------------------------------------------
void DataFlashWake (void)
{
//Setup SPI for DataFlash
//MSB 1st, Master, Mode3, Fosc/2
SPSR= 1<<SPI2X;
SPCR= 0<<SPIE | 1<<SPE | 0<<DORD | 1<<MSTR | 1<<CPOL | 1<<CPHA | 0<<SPR1 | 0<<SPR0;

if (bAT45revD)
    {
    DF_SELECT();
    SPDR=DEEPPOWERWAKE;	WaitSPI();
    DF_DESELECT();
    }
}

//Read Manufacturer and Device ID
//---------------------------------------------------------------
static bool IsRevisionD (void)
{
uint8_t manfId;
bool b_isRevD;

DF_SELECT();
SPDR=DEVICEIDREAD;	WaitSPI();

SPDR=0; WaitSPI();
manfId=SPDR;
DF_DESELECT();

b_isRevD=false;
if (manfId==0x1F)
	b_isRevD=true;

return b_isRevD;
}

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

thank you sir for your help, this code may help me but i have doubt that  the speed difference of chip selection and page programing time all are affected or not? nd yeah i have one problem after using the at45db081E IC, after reset my device data doesn't store. 

 

wait  i can explain i have a data logger device in which i  have used one flash memory IC to store the data. we used AT45DB081D but after obsolete this IC  i have to used new version AT45DB081E IC . i have met this problem "when i am pulling the data from sensors in to data logger device data will be shown but after to reset my device (power supply switch OFF then switch ON which is applied to data logger) data will not store in this flash memory IC"

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I missed the fact you are upgrading from D variant to E variant, (that's a symptom of hi-jacking an original thread). When I did that in my design it was a drop-in replacement; no code changes were required.

I can't help much farther than suggest to re-read the datasheet in case you've missed something and make sure you comply with all the requirements.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 drop-in replacement; means ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

riddhi patel wrote:

 drop-in replacement; means ?

A replacement you can just "drop in". In other words the new one just works in the much the same way with the same electrical and software interfaces.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

and there is a simple change in this two IC. i have attached here. so i am confused that there is hardware problem or software problem old IC is running good and new version ic has a problem of storing data. please help me to get out of this.

Last Edited: Tue. Apr 24, 2018 - 12:19 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

But those slightly longer times don't matter do they? Usually in AT45 code you issue the "long" command then you do that thing where you keep polling the status out of the device by reading bit 7. So if the wait loop takes a fraction longer it shouldn't matter should it. Of course if you were doing something mad like:

issue_page_erase();
delay_ms(32)
start_writing();

then that could get "caught" by such a change. But like I say you actually do something more like:

issue_page_erase();
while(1) {
    issue_status_command();
    if (!(SPDR & 0x80)) break; // status cleared - so end
}
start_writing();

So this will just come back from the erase() once the device signals it has completed.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

and i cant understand that how to provide delay in flash program