- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi every body.I use an electronic board that contain at25f2048(eeprom).So i want to connect psoc5lp prototype kit with this eeprom chip.I want to know how can i use eeprom component in psoc creator to write and reed in my chip?
tanks for your attention and supporting...
Solved! Go to Solution.
- Labels:
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
EEProm component is for the PSoC5 internal eeprom (2kB). The emfile component allows for os-compatible sd cards.
All eeprom is prone for power-losses while programming is in progress. A power supply that can overcome some 20ms line losses should be considered.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Datasheet of at25f2048 tells that it uses an SPI interface. So drop an SPI Master component onto your topdesign and write some lines of code to access it as required.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tanks dear Bob.why i cant use eeprom component or emfile in psoc creator to reed or write on at25f2048?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
EEProm component is for the PSoC5 internal eeprom (2kB). The emfile component allows for os-compatible sd cards.
All eeprom is prone for power-losses while programming is in progress. A power supply that can overcome some 20ms line losses should be considered.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi MR Bob Marlowe.i cant runnig and get RDID(chip id).so please see my code and tell me why it is not working?
please see my code here :
#include <project.h>
#include <stdio.h>
#define RDID 0b00010101
uint8 readid=0u;
int main()
{
CyGlobalIntEnable; /* Enable global interrupts. */
UART_Start();
SPIM_Start();
for(;;)
{
//SPIM_WriteByte(RDID);
SPIM_WriteTxData(RDID);
while(readid==0u)
{
readid=SPIM_ReadRxData();
//readid=SPIM_ReadByte();
}
UART_PutChar(readid);
CyDelay(500u);
UART_PutChar('\n');
readid=0u;
CyDelay(5000u);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You read from SPIM without checking / waiting before a byte has been received. Use API SPIM_GetRxBufferSize() to see how many bytes there are. UART_PutChar() will not write ASCII chars, I would suggest using sprintf() to convert to a readable string.
For every bit (byte) the SPI interface gets, one bit (byte) is returned immediately. When the very first byte is sent, the interface does not "know" yet what to answer, so a dummy byte is returned which should be skipped.
SPI has no read command, so you must send dummy bytes to retrieve the information wanted.
A pitfall is the select line, which is automatically taken low when a byte is sent. When the buffer is empty it is taken high again. This can lead to interface errors when the byte sequence is not provided fast enough resulting in ss-line glitches.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry... I cant understand what should i do for your explanation.can you give me any example for correct send and receive data in spi mode?
tank you...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
tankyou dear Bob...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Bob
I can get chip ID from below code but i cant READ or Write.I cant find where is my mistake and how can i do it.help me plz?
SPIM_ClearTxBuffer();
SPIM_ClearRxBuffer();
SPIM_WriteTxData(RDID);
SPIM_WriteTxData(RDID);
while (!(SPIM_STS_SPI_DONE | SPIM_STS_SPI_IDLE))
size=SPIM_GetRxBufferSize();
sprintf(a,"size=%3d",size);
UART_PutString(a);
UART_PutChar('\n');
while(SPIM_GetRxBufferSize())
{
readid=SPIM_ReadRxData();
//readid=SPIM_ReadByte();
}
sprintf(a,"readid=%3d",readid);
UART_PutString(a);
CyDelay(500u);
UART_PutChar('\n');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you please post your complete project, so that we all can have a look at all of your settings. To do so, use
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You are not following the scheme with the CS-line. The signal is continuosly driven low by your hardware design. Remove the "Logical 0" component, the connection, uncheck the "Hardware connection" in the pin and finally set the initial drive state to High. Now you can manage the CS state.
The CS should be taken low just before the transmission starts and must be taken high again when the transmission has finished which can be checked by the number of bytes received in the buffer.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
while (!(SPIM_STS_SPI_DONE | SPIM_STS_SPI_IDLE))
You are testing bits, but not the status of the SPIM. Use SPIM_ReadTxStatus() & (SPIM_STS_SPI_DONE | SPIM_STS_SPI_IDLE)
Set the Heap size to 0x200 when using sprintf
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Do not keep CS low for a very long time as printing to UART. Define your transaction, get the bytes and finish. Do not send multiple commands without de-asserting CS
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
MR Bob Marlowe do you have telegram or whatsapp to connect and speak faster?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I can not solved my problem with AT25F2048 yet. what is my mistake in program???I think my problem is spi interfacing because i observation code to read and write...it there any mistake?how can i understand???
please help me...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Use
CS_Write(0);
SPIM_WriteTxData(RDID); // Read ID command
SPIM_WriteTxData(0x00); // Dummy write to get result
while (!(SPIM_ReadTxStatus()&SPIM_STS_SPI_IDLE)) { } // Wait for complete transfer
CS_Write(1); // End of transaction
SPIM_ReadRxData(); // Read off first unsusable byte
readid=SPIM_ReadRxData(); // Read ID
Change the other parts accordingly.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When the readID works, concentrate on the next step only. Lesser to change and fewer to observe.
The CS de-selection might be too short: the time between writing a 1 and starting the next transaction.
When readID works, you can write a function that reads one byte from a given register making it easier to expand the project. Do not forget to get the device out of sleep mode.
A bug is
SPIM_WriteTxData((char)(addr>>8));
a 8bit value >> by 8 will always result in zero.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
TopDesign and spi setting has not problem? and i set 1 mil second delay time after per CS de-selection changes but just RDID worked.
even i just send read-register to read 1 byte from memory but it is not worked.
I am very confused... excuse me for flooding forum...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
in LPC2138 and AVR microcontroller for working with AT25F2048 should send address of memory byte to read or write on them as bellow:
addr>>8 and then sending just : addr
so you think it is wrong?how can i correction memory address byte?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
?how can i correction memory address byte? Define "address" as uint16 (and not uint8)
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I use ready example from this site and change psoc3 to psoc5 and i dont change any other parameters, but Eeprom not read or write.
below is example address link :
http://www.cypress.com/knowledge-base-article/spi-eeprom-interface
what do you think about my problem.i khow that i have a mistake.but i cant find what is it!!!???
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The example looks quite different to your project. I would like to see the changes I suggested and the results. Sorry, but I do not have got an SPI EEPROM to test/check the project. Helpful for you could be a logic analyser to check the communication.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is running eeprom with psoc5 file in cypress example.i just changed psoc3 to psoc5 and change pin on port2.and replace uart with lcd and use dummy byte as you said to working...but it is not worked...just give a chip id .and any other function (write&read)back zero....
Please tell me what can i do to solved problem???
Tankyou for your attention...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This was correct to read the ID from eeprom
SPIM_WriteTxData(RDID);
SPIM_WriteTxData(0x00);
while (!(SPIM_ReadStatus() & SPIM_STS_TX_FIFO_EMPTY)) {}
SPIM_ReadRxData(); // Read off first unsusable byte
readid=SPIM_ReadRxData(); // Read ID
The second write was needed to get an answer (ID) back from device. On all other of your acesses you again write an additional byte without expecting a value back. Read google's explanation how SPI works, I think it is not quite clear for you.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am changed your explenation in my project.but it is not worked .when i read every write data on spi,get zero for reply.below is out result for status of any command operation :
AT25F2048...
readid= 31
STATUS_WREN= 0
STATUS_PROG= 0
STATUS_addr= 0
STATUS_data= 0
STATUS_READ= 0
STATUS_addr= 0
STATUS_data= 0
readid= 31
STATUS_WREN=255
STATUS_PROG=255
STATUS_addr= 0
STATUS_data=128
STATUS_READ= 0
STATUS_addr=255
STATUS_data= 0
I changed clock on 1000kbps .
I cant understand why it is not working?please tell me which line of project is wrong?
line 200 in my project is true?(is read data operation true?)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No body is here to help me for solving problem?