View previous topic :: View next topic |
Author |
Message |
Sterngleiter
Joined: 07 Jan 2013 Posts: 90
|
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9255 Location: Greensville,Ontario
|
|
Posted: Tue Mar 26, 2013 2:25 pm |
|
|
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
|
|
Posted: Tue Mar 26, 2013 3:47 pm |
|
|
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
|
|
Posted: Tue Mar 26, 2013 10:07 pm |
|
|
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
|
|
Posted: Tue Mar 26, 2013 10:40 pm |
|
|
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
|
Both of us? |
Posted: Wed Mar 27, 2013 10:36 am |
|
|
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
|
|
Posted: Wed Mar 27, 2013 2:29 pm |
|
|
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
|
|
Posted: Fri Apr 05, 2013 1:42 pm |
|
|
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: 9255 Location: Greensville,Ontario
|
|
Posted: Fri Apr 05, 2013 2:13 pm |
|
|
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: 9255 Location: Greensville,Ontario
|
|
Posted: Fri Apr 05, 2013 2:18 pm |
|
|
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
|
|
Posted: Fri Apr 05, 2013 2:19 pm |
|
|
#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: 9255 Location: Greensville,Ontario
|
|
Posted: Fri Apr 05, 2013 2:45 pm |
|
|
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
|
|
Posted: Fri Apr 05, 2013 2:53 pm |
|
|
I use to test purposes with the PIC16F690 throttled Vdd, it works at a graphic display (SPI) |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9255 Location: Greensville,Ontario
|
|
Posted: Fri Apr 05, 2013 3:03 pm |
|
|
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
|
|
Posted: Fri Apr 05, 2013 3:09 pm |
|
|
"PIC16F690" with internal oscillator 4Mhz, do you think it's not running |
|
|
|