PSoC™ 4 Forum Discussions
Hello
I am using PSOC Creator 4.4. I have been trying to get the uart to work and send text or numbers out to TeraTerm. I wrote a very simple program (attached below). The program will build, and when programmed into the device (cy8ckit-146 PSOC 4200DS) will send out something. What you see on the terminal is the word "nul" in very tiny letters. When I look at the pin on oscilloscope, the pin goes to zero for 2 seconds and then returns high again.
In the simple program below, inside the for(;;) loop are commented out lines that I tried and did build, but the only thing that was displayed was "nul" in tiny letters.
What am I doing wrong?
///*********************************************
#include "project.h"
#include <stdio.h>
#define io_stdin_enable
#define io_stdio_SW_TX_UART
int n;
uint8 DataBite = 4u;
void SW_Tx_UART_Start(void);
int main(void)
{
for(;;)
{
// void SW_Tx_UART_Start(void);
// void SW_Tx_UART_PutString();
//void SW_Tx_UART_PutHexByte(uint8 );
//void SW_Tx_UART_PutHexInt();
void SW_Tx_UART_PutChar(uint8 txDataBite);
}
}
Hi,
I am using PSOC4 to control WS2811 (RGB LED) with a 1-wire protocol.
I modified the control using PWM with the PWM SAMPLE CODE. Initially, I intended to use interrupts to count 24 PWM pulses. However, the actual number of generated PWM pulses exceeds the number of interrupts.
If I want to generate a specific number of PWM pulses, how should I proceed?
/******************************************************************************
* Function Name: Isr_TC_Handler
******************************************************************************/
CY_ISR(Isr_TC_Handler)
{
/* Clear the TC Interrupt */
PWM_ClearInterrupt(PWM_INTR_MASK_TC);
/* Counting the number of PWM pulses generated. */
if(bits >= 24)
{
bits = 0;
PWM_Stop();
pwmStop = 1;
}
else
{
PWM_WriteCompare(WS2811_Bit1);
bits++;
}
}
/******************************************************************************
* Function Name: main
******************************************************************************/
int main()
{
/* Enable the global interrupt */
CyGlobalIntEnable;
/* Enable the Interrupt component connected to the PWM interrupt output */
Isr_TC_StartEx(Isr_TC_Handler);
/* Start the PWM Component */
PWM_Start();
for(;;)
{
}
}
Show Less
Recently, I conducted a test using CY8C4014LQI-422, which mainly has the following problems:
1、During the test, I found that raw count and diff had a slow rising trend as the temperature of the test environment increased. According to the documentation AN85951, baseline is the compensation for raw count temperature. In fact, during the test, the temperature had little effect on the baseline.
In this chart, I use a hot air device for heating. But the difference in its temperature is still relatively large. Please explain the relationship between temperature and raw count, baseline and diff.
2、When I use capsense, I expect a steady baseline at initialization. The current set of parameters is as follows: SACN 14 bit RESOLUTION -, CsdRawCountCalibrationLevel-10, in theory, should be the baseline initial value of 1683, but the current initial value is 2004. Please help to find out the problem
Best regards,
BonesBao
.
Show Less
I have tried to install PSoc creator. Nothing seems to work.
Hi ,
因为 PSoC4 TCPWM组件最多只有5个,想请教一下,Smart IO 是否可以将一个 PWM 组件的信号路由多路出来(例如可以用来控制多路灯),如何单独的控制每一路?
谢谢!!
Hi, Community
I have something I would like to confirm about the generation of Capsense architecture.
In table2 Device family of AN85951, we can see that PSoC4000 is the 4th generation of CAPSENSE.
However, the Product over view document "PSoC 4S-Series: Scalable, Smart MCU Portfolio" (page 11) available from the product homepage states that PSoC4000 is 3rd generation.
I could not identify which is correct from the datasheet, so please let me know the correct answer.
Best Regards,
Chihiro Tatebayashi / NEXTY
Show LessI'm porting a project from another CPU that measures capacitance for level detection. Yes, I know CapSense can do this, but the complexity is huge overkill for this project, and trying to sort through it all and distill a simple case like I need was daunting. So you might say I'm reinventing the wheel, taking advantage of some of the PSOC features, possibly derived from CapSense. The basic algorithm is as follows:
- Set the pin as an open drain output low (to force it to zero)
- Switch to hi-z analog and pull up with an IDAC
- At the same time start a timer
- There is a comparator on the pin. When it transitions, the timer value is captured
The count of the timer will be proportional to the capacitance on the pin, because the IDAC is charging that capacitance and the comparator indicates when a certain charge level has been reached and captures the elapse time.
My biggest issue is that I don't know how to switch from open drain to analog. I thought that SetDriveMode should do it, and that the analog output (which is a small current) would just be overridden by the open drain pulling it down. However, it seems that the open drain isn't in the pin circuit at that point. I can't seem to find a register that switches the pin to analog, other than the mode, or that disables the output circuitry because it is connected to the IDAC.
A similar scenario exists in trying to read resistive touch screens where some pins need to drive high or low at certan times and at other times become ADC inputs.
Is there a way to do this from the program?
A related problem I found with the 4200M was that I couldn't find a way to access the reference. It seems that all reference outputs are dedicated. I wanted a reference voltage to be an input to a comparator, but I couldn't find a way to do that or to bring it out to a pin so I could then re-insert it. I did the next best thing--I sent the other IDAC to a pin and attached a known pull down resistor to it to generate a regulated voltage, and used that pin as an input to a comparator, so I have a work around, but I was surprised that I couldn't access the reference directly.
Wilton
Show Less
I've worked with other kits and processes, and haven't seen this, but I have two problems.
1. When I run the kit with PSOC creator (download and run) everything works fine. But after it is programmed, if I unplug the USB and plug it back in (to provide target power. It doesn't start--i.e. I assume it doesn't get a reset. I would expect power on reset to take care of this. Looking at the schematic, there is no pull up on reset or a capacitor to ground or other way to externally do a POR, but the IC is supposed to reset. Maybe KIT-PROG2 is holding it in reset? My goal is to leave KIT-PROG2 attached so I can access data via the virtual com port, and also possibly update the code.
2. After I plug USB back in, if I press reset on the KIT-PROG2 (which asserts XRES on the target directly) it does come to life. Of course that isn't useful in an embedded application with no UI. But maybe it sheds some light on the first problem. HOWEVER, one of my serial commands that starts an I2C device operating never returns when the program starts this way. Looking into it, I found that it is stuck in the default interrupt handler and it got there after an I2C status function disabled interrupts read some stuff from the I2C working memory and then re-enabled interrupts on exit. When it re-enabled interrupts is when the unhandled interrupt occurred. Strangely, if I download and run this unhandled interrupt doesn't occur, only if it was powered up and then XRES asserted and then this status function called. Seems like restoring interrupts turns on more than it turned off or something.
Any ideas on either of these?
Thanks,
Wilton
Show Less