PSoC™ 4 Forum Discussions
Hello everyone,
I am developing at a very low level communication between the PSOC-4 and a SD card via SPI protocol. In this whole process I'm at the point where I need to transfer 514 bytes per SPI to the SD card (MOSI).
The concept is very simple but I have a lot of problems with increasing the data rate of the SPI block. The whole setup works fine below 1.5 Mbps, but when increasing to 4Mbps with oversampling at 16 (3Mbps real) the DMA transfer stops working properly. I have tried to narrow down the problem as much as possible and it seems that the problem is in the behaviour of the DMA block.
To rule out that there is no problem with the SPI block I have increased to 8Mbps data rate and used the CPU to communicate with the card and everything has been successful. I would like to remind you that at lower speeds of 1 and 1.5 Mbps everything works fine with the DMA. At first I have worked with these low frequencies to be able to analyse the communication with a logic analyser. My idea was, that once everything works fine, to simply increase to the maximum speed.
In order not to go into too much detail I can reduce the problem to a simple SPI transfer with DMA (forgetting that the communication is with an SD). I simply need to transmit 514 bytes of data over the MOSI line at over 3 Mbps.
The information flow is simple, once everything is ready, the DMA descriptor is validated and the channel is enabled to start the transfer to the FIFO register of the SPI module. The problem is that in the interrupt function that is indicated to the DMA it jumps with an error. The error produced is obtained with TxDMA_GetDescriptorStatus(0);. The normal behaviour is that the DMA generates an interrupt with that flag to CYDMA_DONE. Instead it generates two interrupts with the flag to CYDMA_INVALID_DESCR.
The weirdest thing is that it works at low data rates and doesn't work at high data rates. I think I'm missing something and I don't understand what.
The part of the code that involves this problem is first of all the initialisation:
struct DataPacket{
// char token;
char data[512];
char CRC[2];
}__attribute__((packed));
struct DataPacket multipleWriteBuffer;
int main()
{
TxDMA_Start((void *)&multipleWriteBuffer, (void *)SPI_TX_FIFO_WR_PTR);
TxDMA_SetInterruptCallback(TxDMA_Done_interrupt);
CyIntEnable(CYDMA_INTR_NUMBER);
CyGlobalIntEnable;
.....................
The function to be triggered by the DMA interrupt is:
void TxDMA_Done_interrupt()
{
descriptorStatus=TxDMA_GetDescriptorStatus(0);
descriptorStatus=descriptorStatus & 0x00070000U;
switch(descriptorStatus){
case CYDMA_DONE:
{
DMAFlags=1;
}; break;
....................................
case CYDMA_INVALID_DESCR:
{
DebugPin_Write(0);
InvalidDescriptor++;
DebugPin_Write(1);
}; break;
}
}
when I need the to start data transfer:
TxDMA_ValidateDescriptor(0);
TxDMA_ChEnable();
The DMA descriptor configuration is:
The SPI advanced tap configuration is :
And less relevant to the case is the spi basic tab:
Conection between SPI and DMA module:
I think including an image of the logic analyzer may help to notice when the InvalidDescriptor event occurs. Remember that I have a debug pin that throws a pulse when this event occurs so I can detect it in the logic analyzer.
General view of the transmission, without zoom:
A zoom in on the area where these events occur:
In summary: every time I start a transfer, the interrupt with the CYDMA_INVALID_DESCR error is raised.
Do you have any idea what is going on?
Thank you for your help.
Hello, I am new to PSOC, and is currently working in CY8C4245AXI-483
I am trying to make a simple project to read and write the data in external eeprom using i2c, untill now i have aquired the result but the data i stored is in "HEX" whereas the data i received on my serial is in ascii
EX: I am sending (0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49)
and receiving "B C D E F G H I
Why do i not get HEX in output and how to get it ???
My code is given below
#include <project.h>
void main()
{
uint16 read_val[8]; //Array to read data from EEprom
uint8 array[8] = {0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49}; //Array to write data to EEPROM
uint8 i;
uint32 status; //variable to read error/status of I2C
I2C_Start();
UART_Start();
for(;;)
{
status = I2C_I2CMasterSendStart(0x50, I2C_I2C_WRITE_XFER_MODE); //Send start with slaveID 80u & write/read transfer mode
if(I2C_I2C_MSTR_NO_ERROR == status) //Check status
{
status = I2C_I2CMasterWriteByte(0x00); //address of eeprom on which data needs to be written
if(I2C_I2C_MSTR_NO_ERROR == status) //Check status
{ //if valid write data to external eeprom
for(i=0; i<8; i++)
{
status = I2C_I2CMasterWriteByte(array[i]);
if(I2C_I2C_MSTR_NO_ERROR != status) //Check status
{ //if success come out of loop
break;
}
}
}
else
{
UART_PutString("error"); //else print error
}
}
I2C_I2CMasterSendStop(); //Send stop
/***************Read that same data from external EEPROM**************************/
CyDelay(500u);
status = I2C_I2CMasterSendStart(80u, I2C_I2C_WRITE_XFER_MODE); //Again send start
if(I2C_I2C_MSTR_NO_ERROR == status) //Check status
{
status = I2C_I2CMasterWriteByte(0x00); //address of eeprom to read data on it
if(I2C_I2C_MSTR_NO_ERROR == status) //Check status
{
CyDelay(50u);
status = I2C_I2CMasterSendRestart(80u, I2C_I2C_READ_XFER_MODE); //Send restart
if(I2C_I2C_MSTR_NO_ERROR == status) //Check status if no error
{
for(i=0; i<8; i++)
{
if(i<7u)
{
read_val[i] = I2C_I2CMasterReadByte(I2C_I2C_ACK_DATA); //receive data bytes with ack
}
else
{
read_val[i] = I2C_I2CMasterReadByte(I2C_I2C_NAK_DATA); //receive last byte with nack
}
}
}
}
}
I2C_I2CMasterSendStop(); //Send stop
for(i=0; i<8; i++)
{
UART_PutChar(read_val[i],); //display data on uart
UART_PutString(" ");
CyDelay(500u);
}
CyDelay(3000u);
}
}
/* [] END OF FILE */
Show LessHi, I am starting out from scratch and I am trying to figure out what I need to get started.
I have been proposed the:
CY8CKIT-046 PSoC 4 L Series development board.
I don't really know how to get started with this? Where do I download the compiler software "Psoc Creator"??? Is there any simple examples like blink a led to get me started????
Also I am reading the "Infineon Lit Prog" user guide". On page 8 of the guide (please view image below), they show an image with what seems to be a PCB board plugged into a strange socket on a PC.
And yet they describe this as "Connect USB cable to J6 (Prototyping kits)"???? Why do they call it a cable when its a PCB???? and where is J6???
Thank you for all help
r
Show Less
Hi,
We are trying to execute an application by using your “CY8C4014LQI-24-QFN“ processor. However we have an problem on programming this chip.
When we make a short search we can find in your site(https://www.cypress.com/products/psoc-programming-solutions) that can be done by using MiniProg4 and MiniProg3. In addition to this devices we also figured out that the programmer part of “CY8CKIT-147 PSoC® 4100PS Prototyping Kit” can also have ability to programme any kind of Cypress processor. But we could not achieved for programming our chip. So i have below question about this situation.
1-) Are MiniProg3-4 devices the only solutions to programme “CY8C4014LQI-24-QFN“ processor or like we found in internet this can be made by using programmer part of “CY8CKIT-147 PSoC® 4100PS Prototyping Kit” having “CY8C5868LTI-LP039” processor for controlling programming jobs.
Show LessHello,
I am trying to use the psoc 4 mcu as a timer that switches a GPIO between high (20 minutes) and low (10 minutes) states. I want the mcu to be in deepsleep most of the time and just toggle the GPIO every 20 / 10 minutes.
How can I do this and is there some sample code to refer to?
Thanks
Show Less
请问Hex File中的下面红色加粗的内容代表的是什么?
程序升级成功之后其中AB00会变成AB11,这样会有问题吗?
:0200000490303A
:02000000B9D273
:0200000490402A
:4000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0
:0200000490501A
:0C00000000021C5911AB00011CA6CB7DB6
:0200000490600A
:0100000001FE
:00000001FF
Show Less
Hello
I have a hw design where i use a CYBLE-222014 and some PWM controlled LED's.
My problem is that one of my LEDS is hw wired to pin 4.0, which is not routeble from PsoC Creater.
How can i from code make it posible to adjust PWM on PIN 4.0 ?
Show Less
Hello,
Our company is looking to move forward with Bluetooth SIG testing and we require the QDID numbers for the CY8C4248LQI-BL573 microcontroller. I've checked the datasheet and a few application notes and have not found this information. Can someone help?
For the stack QDID, where in the Cypress software libraries can we find this information?
Thanks!
Show Lesshey! Community.
I'm facing one issue while programming CY8CKIT-145-40xxS PSoC DevKit. I ordered CY8CKIT-145-40xxS PSoC now I'm playing with that kit I started following the User guide of that Kit.
I performed these steps
1) Download and installed PSoC 4 IDE
2) install Kit package from here
3) create a new blank project
4) Select kit as shown below
5) Compile/build project
6) insert kit to the USB port of the laptop
7) Select the programmer
8 ) Acquire the port
and that point I'm getting this error.
I'm waiting for few seconds and got this message pop-up.
Thank you 🙂
Show Less