PSoC™ 4 Forum Discussions
Hey guys!
I'm a new user with Cypress MCU and PSoC creator. I've built up a program for my demo board, it seems good.
but I got one question for the WDT code which I downloaded from the homepage. I copied the WDT code in the code source, and I think it is too big to put it in main function. So I wonder if there is some other ideas to simplify the WDT code and make the main function much more slim.
Can anybody help me to solve this problem?
thank you!
int main(void)
{
uint8 key=0,mot_ope=0;/* the mark used for key pressing and motor operation*/
uint8 mode=NORM_MODE;/*dfault mode is set to be normal mode*/
uint32 tempIloCounts = 0u;
/* Turn on Red LED for 2 seconds if reset caused by WDT */
if (CY_SYS_RESET_WDT == CySysGetResetReason(CY_SYS_RESET_WDT))
{
/* Update flag in order to clear WDT */
resetFlag = RESET_FLAG_ACTIVE;
/* Turn on Red LED */
UI_LOWBAT_Write(0);
CyDelay (500);
UI_LOWBAT_Write(1);
/* Make sure that interrupt is forwarded to the CPU */
CySysWdtUnmaskInterrupt();
}
else
{
/* Turn off Red LED */
UI_LOWBAT_Write(1);
/* Configure WDT to be 15-bit wraparound up-counter - 1 MSb is ignored */
CySysWdtSetIgnoreBits(1);
}
/* Configure WDT ISR */
WdtIsr_StartEx(WdtIsr);
/* Start the WDT */
CySysWdtEnable();
/* Starts the ILO accuracy/Trim measurement */
CySysClkIloStartMeasurement();
CyGlobalIntEnable; /* Enable global interrupts. */
ADC_1_Start();
ADC_1_StartConvert();
ADC_2_Start();
/* Place your initialization/startup code here (e.g. MyInst_Start()) */
for(;;)
{
CyDelay (5);
/* If the interrupt has occurred in the ISR */
if(SET == interruptFlag)
{
/* Clear the watchdog interrupt */
CySysWdtClearInterrupt();
/* Enable WDT interrupt */
CySysWdtUnmaskInterrupt();
/* WDT match value is updated in order to obtain periodic interrupts */
CySysWdtWriteMatch(CySysWdtReadMatch() + iloMatchCounts);
/* Clear the software interrupt flag */
interruptFlag = CLEAR;
}
/* Get the ILO compensated counts i.e. the actual counts for the desired ILO frequency
Trimming is done to improve ILO accuracy using IMO; ILO default accuracy is +/- 60% */
if(CYRET_SUCCESS == CySysClkIloCompensate(DESIRED_DELAY, &tempIloCounts))
{
iloMatchCounts = (uint32)tempIloCounts;
/* Once the counts are ready - stop the ILO measurement and put the device to deepsleep */
CySysClkIloStopMeasurement();
/* Start the ILO measurement after wake up */
CySysClkIloStartMeasurement();
}
/* Place your application code here. */
Show Less
What I use : CY8CKIT-042-BLE-A
I have been a lot of fun lately while I using PSoC dev kit. But sometimes it got frustrated if ithis kind problem is occured.
My project's input clock is 12MHz, and I want to get PWM freqeuncy which is 108kHz and 50% dutycycle. And I want to increase the frequency by 1. (108 -> 109-> 110 -> 111...)
So I configured input clock, period, compare like picture above. After finish the compiling, and I checked frequency using oscilloscope. But I only got 106kHz freq which is 2kHz less than my desired frequency. I even change to 109kHz frequency, but I only got 107kHz. Same thing happened this time.
why the frequency always 2kHz less than desired value? And how can I fix this problem?
I hope I get the answer.
Best regards.
Show LessHi,
I have this TFT display: https://www.az-delivery.de/it/products/1-8-zoll-spi-tft-display
How can I connect to my card? Tried with various libraries and tutorials for other PSoc cards (5)
Show LessHello all,
i am working on cy8c4247 AZI- L445. i am trying to make hid-touchpad compatible with windows. i have gone through the datasheets and reference modules. but whenever i am selecting the option of Capsense, then Gesture option is not display on the Capsense dialogue box. i am stuck to sense finger by using touchpad. anybody knows please help me as early as possible. Also please send the reference to send the data to the pc using USB.
thanks regards,
sanket more
Show LessHello all
I want to design interrupt line from master and slave to send data I implement this part but I have a question how to now that the master of tivac send read request to cypeass i2c slave ?
help me with this information, please
Show Less
Hii all,
i have question regarding software for HID touchpad.
i am using CY8C4246AZI-L445. I want to get Touchpad data using CSX method without using Gesture feature.
Please help me out to get all touchpad data using CSX method. already i saw that CSX method for touchpad but in that Gesture is already added.
So please send any reference data or programming material to get result.
Thanks in advance,
Nagnath
Show LessHello all,
Currently i am developing software for USB-HID Touchpad.
I am using IC CY8C4246AZI-L445. I am trying to fetch XY Co-ordinates from touchpad without using Gesture feature.
All over data i am sending to pc using USB_HID is done.
Please Help me out to get XY proper co ordinates from touchpad without gesture.
Thanks,
Pragati
Show LessHello to everyone,
I'm new to PSoC processors. I have the CY8CKIT-041-40XX development kit. I want to run SPI communication. I want to perform this communication in PSoC4 with the LoRa module that I have previously implemented in the STM32 SPL library. But I'm having problems with interrupts. I failed to use the SPI TX empty and RX not empty flags. Without them, I cannot perform SPI_Tx and SPI_Rx operations. If I enable interrupts in the block diagram, I get stuck in the SPI_1_Start() function in the code part, and the code does not progress. If I don't enable interrupts, the code will progress, but I cannot read data in SPI. My code may also be faulty as I am very new to PSoC. I would be very grateful if you could help me with this.
Show Less
Herkese merhaba,
PSoC'de yeniyim ve öğrenmeye çalışıyorum. PSoC4 CY8CKIT-041 kitine sahibim. SPI ile iletişim kurarak LoRa modülünü çalıştırmakta zorlanıyorum. LoRa modülü iyi bildiğim ve STM32, Renesas gibi işlemciler üzerinde çalıştırdığım bir modül. Ama PSoC ile sorun yaşıyorum, özellikle SPI'da takıldım. SPI TX ve RX fonksiyonlarının resimlerini ekledim ve projeyi ayrı ayrı ekledim. Kontrol edebilirsin. SPI'da komut gönderme ve alma konusunda bana yardımcı olabilir misiniz? Benim için doğru komut fonksiyonlarını oluşturabilir misin? Şimdiden teşekkürler.
Show Less
Hello Everyone,
I'm using 4100PS development kit CYC8KIT-147.
in my project i used one PWM block and 2 timer for capturing and reload to measure frequency and duty cycle, but when i tried to connect PWM output line or line_n to reload or capture then i'm getting the following errors which you can see in the attached picture.
If anyone has an idea then please share.
Thank you
Show Less