CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

AT45DB161D Help !!!!!
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Sterngleiter



Joined: 07 Jan 2013
Posts: 90

View user's profile Send private message

AT45DB161D Help !!!!!
PostPosted: Tue Mar 26, 2013 2:05 pm     Reply with quote

Hallo,
can someone please help me how can I use this block
" http://www.adestotech.com/sites/default/files/datasheets/doc3500.pdf ".
I'd love to write in and read some data. I can not really see anything from the data sheets. SPI is known to me. I would be happy to see code examples.
temtronic



Joined: 01 Jul 2010
Posts: 9243
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Mar 26, 2013 2:25 pm     Reply with quote

First obvious place to start is the datasheet....

..what PIC have you decided on using ??

Second, try 'googling' and see what relevent 'hits' are found.

Third, what 'platform' have you done? Wirewrap,PCB,breadboard,???

we need more info....

jay
Sterngleiter



Joined: 07 Jan 2013
Posts: 90

View user's profile Send private message

PostPosted: Tue Mar 26, 2013 3:47 pm     Reply with quote

I use PIC18f8622, Platform is PCWHD Vers.4.134, Googling no success, The Application Note is an example in C for AVR. I understand some of it. But very much unclear how the reading of buffer with. As I understand from the data sheet, the data from Page X to buffer is loaded then it is read from right?
milan.rajik2013



Joined: 26 Mar 2013
Posts: 3
Location: Moscow

View user's profile Send private message Send e-mail

PostPosted: Tue Mar 26, 2013 10:07 pm     Reply with quote

Sterngleiter wrote:
I use PIC18f8622, Platform is PCWHD Vers.4.134, Googling no success, The Application Note is an example in C for AVR. I understand some of it. But very much unclear how the reading of buffer with. As I understand from the data sheet, the data from Page X to buffer is loaded then it is read from right?


To write to the DataFlash you have to make WP pin high (can be done from microcontroller or by connecting to Vcc)

Everything is mentioned in the device datasheet. Can you post your Schematic and Code. It will be helpful to analyze.
_________________
Regards
Milan
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Mar 26, 2013 10:40 pm     Reply with quote

milan.rajik2013 wrote:
Can you post your Schematic and Code. It will be helpful to analyze.

He has no code. He wants us to provide him with code. He said:
Sterngleiter wrote:

I would be happy to see code examples.


CCS has a driver for the at45db021. Buy the chip, use this driver,
and test it. Both of you:
Quote:
c:\program files\picc\drivers\at45db021.c
milan.rajik2013



Joined: 26 Mar 2013
Posts: 3
Location: Moscow

View user's profile Send private message Send e-mail

Both of us?
PostPosted: Wed Mar 27, 2013 10:36 am     Reply with quote

Sterngleiter wrote:

I would be happy to see code examples.


Yes. I missed that.

[quote]
CCS has a driver for the at45db021. Buy the chip, use this driver,
and test it. Both of you:
Quote:
c:\program files\picc\drivers\at45db021.c


Both of us? You mean Sterngleiter and myself?
_________________
Regards
Milan
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Mar 27, 2013 2:29 pm     Reply with quote

What I meant was, you both would learn a lot more if you setup a
hardware board and experimented with the CCS dataflash driver,
and if you wrote the PIC code to talk to the driver. You would learn
more than if we gave you code (assuming we have any to give).
Sterngleiter



Joined: 07 Jan 2013
Posts: 90

View user's profile Send private message

PostPosted: Fri Apr 05, 2013 1:42 pm     Reply with quote

output_low(pin_c3);
spi_xfer(SPI_1,0xd7,8);
output_high(pin_c3);
delay_ms(5);
output_low(pin_c3);
spi_xfer(0x84); //opcode
spi_xfer(0x00); //byt 1 page
spi_xfer(0x00); //byt 2 page
spi_xfer(0x01); //buffer adresse
spi_xfer(0x04); //data
output_high(pin_c3);
delay_cycles(1);
output_low(pin_c3);
spi_xfer(0x84); //opcode
spi_xfer(0x00); //byt 1 page
spi_xfer(0x00); //byt 2 page
spi_xfer(0x02); //buffer adresse
spi_xfer(0x05); //data
output_high(pin_c3);

Earlier, I tried to write some data in the buffer, and below I try to read from the buffer out. I think it does not work out right the second is worth several times the first ausgelesn and not what's wrong here

void lesen(void)
{
test[1]=0;
test[0]=0;
output_low(pin_c3);
spi_xfer(0xd7);
output_high(pin_c3);

delay_cycles(10);
output_low(pin_c3);
spi_xfer(SPI_1,0x54,8);
spi_xfer(SPI_1,0x00,8); //byt 1 page
spi_xfer(SPI_1,0x00,8);
spi_xfer(SPI_1,0x01,8);
delay_cycles(5);

test[0]=spi_xfer(2);
test[0]<<=8;
test[0] &=0xFF00;
test[0] +=spi_xfer(2);
delay_cycles(5);
output_high(pin_c3);

delay_cycles(10);
output_low(pin_c3);
spi_xfer(SPI_1,0x54,8);
spi_xfer(SPI_1,0x00,8); //byt 1 page
spi_xfer(SPI_1,0x02,8);
spi_xfer(SPI_1,0x02,8);
delay_cycles(5);

test[1]=spi_xfer(2);
test[1]<<=8;
test[1] &=0xFF00;
test[1] +=spi_xfer(2);
delay_cycles(5);
output_high(pin_c3);
delay_ms(200);
}
temtronic



Joined: 01 Jul 2010
Posts: 9243
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Apr 05, 2013 2:13 pm     Reply with quote

I have a very hard time believing you can get a 3 volt flash memory chip to interface correctly with a 5volt PIC.
Seems all the 'new' stuff is 3 volts....so I downloaded that spec sheet.

Something gnaws at me that the SPI port is ST rated.
Perhaps you can show us which pins you're using for SPI ?

cheers
jay
temtronic



Joined: 01 Jul 2010
Posts: 9243
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Apr 05, 2013 2:18 pm     Reply with quote

OK, curiosity got the better of me, and I downloaded the PIC datasheet.
Just as I suspected, the SPI pins are ST type and require a Vin of .8*Vdd.
So .8*5 is 4.0Volts which you'll never,ever get out of a 3volt memory device.

When hardware is incorrect, software cannot work.

hth
jay
Sterngleiter



Joined: 07 Jan 2013
Posts: 90

View user's profile Send private message

PostPosted: Fri Apr 05, 2013 2:19 pm     Reply with quote

#USE SPI (MASTER, CLK=PIN_B6, DI=PIN_B4, DO=PIN_C7, MODE=3, BITS=8, STREAM=SPI_1, MSB_FIRST)

Vdd is 3.3 V, 0.8 * 3.3 = 2.64V
temtronic



Joined: 01 Jul 2010
Posts: 9243
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Apr 05, 2013 2:45 pm     Reply with quote

Are you saying you've got an 18F8622 to actually runs right on '3 volts'?

MCHP spec says 4.2 is the minimum for it.
Sterngleiter



Joined: 07 Jan 2013
Posts: 90

View user's profile Send private message

PostPosted: Fri Apr 05, 2013 2:53 pm     Reply with quote

I use to test purposes with the PIC16F690 throttled Vdd, it works at a graphic display (SPI)
temtronic



Joined: 01 Jul 2010
Posts: 9243
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Apr 05, 2013 3:03 pm     Reply with quote

Glad you cleared that up, cause the '8622 won't run that low ! The '690 will, but at less than 10MHz.
Sterngleiter



Joined: 07 Jan 2013
Posts: 90

View user's profile Send private message

PostPosted: Fri Apr 05, 2013 3:09 pm     Reply with quote

"PIC16F690" with internal oscillator 4Mhz, do you think it's not running
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group