PSoC™ 5, 3 & 1 Forum Discussions
text.format{('custom.tabs.no.results')}
Hello there,
I need to use the EP0 for compatibility reason, to control some equipment.
I have followed the suggestion here: Example on how to use the USB control EndPoint EP0
and I had almost working:
I defined
#define USB_EP_0_ISR_EXIT_CALLBACK
void USB_EP_0_ISR_ExitCallback();
in cyapicallback.h
and I wrote this function:
void USB_EP_0_ISR_ExitCallback(){
int length = USB_currentTD.count;
if (length == 😎
for (int i = 0; i< length; i++)
{
Message = USB_currentTD.pData;
}
}
Which reads the data from the USB_cirrentTD.pData.
The issue is that the data seems to be from be one message late. (I have proved this with a USB analyzer).
Let say I'm sending the messages :
[0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
[0x51,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
[0x52,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
[0x53,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
[0x54,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
What the PSoc see is this :
[0x49,x00,0x00,0x00,0x00,0x00,0x00,0x00]
[0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
[0x51,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
[0x52,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
[0x53,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
For some reason, it seems that there is a delay of one message, and the message is queued in the USB_EP0_DR_BASE structure and in the USB_currentTD.pData I read old data.
I proved the above with an USB analyzer, and running the debug in parallel... for example (continuing the example above) I see the message [0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00] on the USB wire, and with the debugger I see that USB_currentTD.pData[0] = 0x49
After the PSoC reset, the first message is always wrong, then the message are consistent, but delayed of one USB message.
Any idea what could be wrong?
do you think the following code is incorrect?
void USB_EP_0_ISR_ExitCallback(){
int length = USB_currentTD.count;
if (length == 😎
for (int i = 0; i< length; i++)
{
Message = USB_currentTD.pData;
}
}
Do you think there is something else wrong?
Thank you,
Francesco
Show LessI am thinking about writing blog articles highlighting the PSOC 5. These articles would be beginner to intermediate, and reflect what I've struggled with and learned.
I would like to hear suggestions on how or where to do this. It would be nice if I could submit to an existing system. I expect to write something about every 2 weeks or so. I use a Mac, so it would be centered around using Virtual Machines, and tricks and techniques when using things like a Mac.
Topics would be general software design principles, A/D, D/A, EEPROM, FreeRTOS, designing with FreeRTOS, using the USB with Mac (and sometimes windows), etc. Also, using with external processors such as the ESP32-WROOM, etc.
The example hardware will be the CY8CKit-059, so it will be inexpensive for someone to use and follow along.
At the beginning, I am not looking for compensation, so that is not a concern. (I won't reject compensation, but it is not my primary goal.)
This will be a first in the blog arena. I have published a computer book, and have written articles for magazines in the past, so I understand what I am signing up for.
comments anyone? (Even negative comments are welcome! My skin is thick, and I know I am an idiot. <grin>)
Show LessHello Everyone,
These are some of my early days working with the Psoc 5LP CY8KIT -059 and I come from a mechanical engineering background so please bear with me.
I am using the SAR ADC to measure 0-5V from the terminal of the DC motor and reading this display on the LCD
I chose the single ended input range i.e from Vssa (GND) to Vdda (5.0V)
This arrangement only gives me a reliable reading from >1V - 5V. Any reading below <1V is displayed erroneously
I also tried switching input range from 0 to Vref*2 ( 0 to 2.048) but this also did not help.
I am having trouble root causing this and would appreciate any input to help me through !
Thanks in advance.
Show LessHello, is it possible for the DDS24 component for PSoc5LP to produce a frequency sweep sine wave between 1Hz and 80Khz at a rate of 8Khz? perhaps by using external components such as the ADS1256? would it be possible to change the frequency sweep from an Arduino/Teensy input?
Show LessHi all,
I am new to cypress community,I am currently working with CY8Ckit-059 psoc kit. I want to read data from the SD card that contaion "new.txt" file.and according to receive data I want to drive some signal(like LED or any thing through GPIO). I am using somthing like Below code. But I am not able to get any data into buffer. so the lile if (n != 0) is not getting executed... even after I am getting pFile as 1 because this loop for( i = 0; i < 5; i++ ) is getting executed I can see that.
can anayboday please help regarding this?
#include "project.h"
#include "string.h"
#include "stdlib.h"
#include <FS.h>
#include <string.h>
#include <Global.h>
int main()
{
char abBuffer[1];
FS_FILE * pFile;
FS_Init();
//FS_Mount(0);
pFile = FS_FOpen("new.txt", "r");
int i = 0;
int n=0;
CyGlobalIntEnable;
if (pFile)
{
for( i = 0; i < 5; i++ )
{
LED_Write(0u);
CyDelay(1000);
LED_Write(1u);
CyDelay(1000);
}
while(NULL != pFile && FS_FEof(dataFile)!=1 )
{
n=FS_Read(pFile, abBuffer, 1);
if (n != 0)
LED_Write(0u);
CyDelay(5000);
LED_Write(1u);
CyDelay(5000);
}
if (abBuffer[0] == 1)
{
LED_Write(0);
}
else if (abBuffer[0] == 0)
{
LED_Write(0);
}
FS_FClose(pFile);
}
}
Show LessHi,
I am using psoc 5lp 059 kit, in that i am using spi connection with sd card (micro sd card 16 gb, class 4, san disk)
In that I have error -1,
ex:
int abx = FS_Mount(sdVolName);
sprintf(cmdnum,"a : %d ",abx);
UART_2_PutString("\n\r");
UART_2_PutString(cmdnum);
UART_2_PutString("\n\r");
abx = -1, and its error of FS_ERRCODE_EOF (End of file reached)
ref: https://www.segger.com/downloads/emfile/UM02001
how to resolve this?
Show LessI have created a blog at http://socmaker.com, where I am posting about PSoC 5LP, combined with 3D Printing.
I had a requirement to add date and time into my compile. This post covers solving that problem using a feature of PSoC Creator:
I will be adding to this blog about one time per week, and checking for comments there at the same time.
Thanks!
Show LessHi,
I have faced a permenant onchip EEPROM damage on a certain byte two times in different units. The byte is stuck at FF no matter what, I tried reprogramming over EEPROM config tool etc. Why this may occur and how can I mitigate this problem?
Best,
Nico
Show LessHi Everyone,
I am facing a problem with SPI communication. I am trying to read data from an external ADC (MCP3201), transform it to temperature value and show it in PUTTY terminal using UART. But I always get garbage value. I am using the ADC as SPI slave and PSOC5LP as SPI Master. I don't understand why I am not getting correct values. Can anyone help? Thanks.
Show LessHi, I am trying to load the chip into a new circuit with miniprog3. It gives the following errors. EraseAll Finished at 00:16:08 | | FAILED! EraseAll operation failed! | Timeout of SPC polling. Lost communication with chip (Status = 0x22) Program Finished at 00:09:30 | | FAILED! Timeout of SPC polling. Lost communication with chip (Status = 0x82) | Programming of Flash Starting... | Erase Succeeded Device set to CY8C5888LTI-LP097 at 00:09:26 | 262144 FLASH bytes Device Family set to CY8C5xxxLP at 00:09:26 | | Automatically Detected Device: CY8C5888LTI-LP097 | JtagID: 2E 16 10 69 Program Requested at 00:09:25 | Successfully Connected to MiniProg3/1343DD00057F at 00:09:16 | MiniProg3 version 2.05 [3.11/2.10] Opening Port at 00:09:16 | Memory Types Load from HEX Finished at 00:09:16 | Device set to CY8C5888LTI-LP097 at 00:09:15 | 262144 FLASH bytes Device Family set to CY8C5xxxLP at 00:09:15 | Memory Types Load from HEX Requested at 00:09:15 |
Show Less