PSoC™ 5, 3 & 1 Forum Discussions
Hi all,
For my senior capstone, my task is to design a feedback system for a DC-AC converter. My plan is implement a controller onto the PSoC 5LP. Right now, I am messing around to try to understand how multiplication works in code. I am generating a wave using the WaveDAC component in the top design. I am attempting to multiply the signal in order to change the amplitude of the sine wave based on the number I am multiplying it by, however, I am getting some pretty funky looking signals at the output. I am new to C programming so is there anything I may be doing wrong? below you can see part of the code I am using to multiply as well as the top design.
Thank you,
int main(void)
{
CyGlobalIntEnable;
double Vcontrol;
int Out;
double Peak_In;
double Mult;
WaveDAC8_1_Start();
WaveDAC8_2_Start();
VDAC8_1_Start();
VDAC8_2_Start();
ADC_SAR_0_Start();
ADC_SAR_1_Start();
Comp_1_Start();
Clock_1_Start();
ADC_SAR_0_StartConvert();
ADC_SAR_1_StartConvert();
for(;;)
{
Peak_In = ADC_SAR_1_GetResult8();;
Vcontrol = ADC_SAR_0_GetResult8() ;
Mult = Vcontrol*Peak_In;
Out = Mult;
VDAC8_1_SetValue(Out);
}
}
Show Less
Hello everybody,
I have implemented the CORDIC as shown in AN2341 using PSoC5LP with very good result in terms of speed by means of Look Up tables.
I reached a speed of 8us to get a complete conversion (considering also the sign of sine and cosine to extend my results up to 360°).
For a new application I would to use the same algorithm but in this case I'm encountering a problem.
I have to divide the 360° into 2400 step to reach my resolution, so the sign 8 bit used in AN2341 do not lead my system to an appreciable accuracy.
I need to increment the CORDIC to at least 10 bit.
Could anyone help me to get extended the look up tables to 10 bit values?
Thanks and regards
Show LessHi everybody.i built a board with quectel GSM M95 and psoc5 for IOT project.now it works well.but sometimes i want to add more ability or change program on psoc5.so i should go to near of device and reprogramming psoc5 with PC .it is very hard for me.so i want to update program on psoc5 with gsm.how can i do it?
is there anybody to help me?
it is very important for me.thanks a lot...
Show LessGood morning,
I don't manage to find a solution to measure the duty cycle in a PWM signal . I have to measure firstly a constant duty cycle for one signale, secondly i have to treat a signal with variable duty cycle ( such as a sine turned into a PWM modulation) ? How to solve the problem ?
Show LessIs there source code for the firmware (hex file) that matches the loopback application located at
C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\application\c_sharp\bulkloop ?
When I try the bulkloop the connected device is visible but the endpoints are empty. The current
firmware hex file is an56377.
Show LessWe have CY8CKIT-001 kit, where we are doing USB communication using USBFS with PSoC5LP Moadule. Now we want to give data received from USB to wavedac where pointer should directly point to EndPoint EP1 of USB communication . How to point directly to Endpoint RAM as we dont want to save the data in RAM array and give it directly to wavedac?
Show LessI'm using CY8CKIT-059 and am attempting to get the USBUART working - preferably including powering the device.
However, in the example code, there is a wait for " USBUART_GetConfiguration() that will wait until that returns a non zero value. It always returns 0.
I've tried the examples, I've verified my clocks.. Code compiles, and programs no problem.
I've got a regular TTL UART working, but I'd much rather use the USB uart so I can have just the one cable running to this module for power and communications...
FYI This doesn't appear to be a windows device issue - it doesn't enumerate because it is stuck in that loop of GetConfiguration.
I've also tried it on two seperate CY8CKit's...
*snip*
int main ()
CyGlobalIntEnable;
/* Start USBFS operation with 5-V operation. */
USBUART_Start(USBFS_DEVICE, USBUART_5V_OPERATION);
for(;;)
{
/* Host can send double SET_INTERFACE request. */
if (0u != USBUART_IsConfigurationChanged()) // THIS ALWAYS RETURNS 0
{
/* Initialize IN endpoints when device is configured. */
if (0u != USBUART_GetConfiguration()) // THIS ALSO ALWAYS RETURNS 0
{
/* Enumeration is done, enable OUT endpoint to receive data
* from host. */
USBUART_CDC_Init();
}
}
*snip
I can get by using an external TTL to USB Serial adapter, but that kinda defeats the purpose Any help would be greatly appreciated..
Show LessHello everyone,
I'm new to the world of embedded (some Arduino experience) and I've scratch my head on a problem for several weeks without any improvements. I also have more experience in the world of FPGA (and maybe my ideas are not ideal for embedded due to that, I always try to do everything in parallel) . I'm coming to you in the hope you could help me.
I'm using a PSOC (FreeSoC2 Development Board - PSoC5LP - DEV-13714 - SparkFun Electronics ) which update a lot a values from different ADC and other modules (via software serial). Updating all the values takes ~500ms. I also have a GUI program in python to show the status of the different modules and to do some basic control. I'm updating the values for monitoring by sending a command via USBUART and waiting for the response.
Right now, the algorithm looks like that (pseudo-code)
-------------------------------------
while(1)
{
if (0u != USBUART_DataIsReady())
{
/* Read received data and re-enable OUT endpoint. */
count = USBUART_GetAll(buffer);
if (0u != count)
{
-> parse data and send the information to the PC (example, if I send 'rt1\r\n', send back the temperature of the 1st device)
}
}
if (flag_timer_interrupt) //interrupt each 1.5sec
{
update_all_values(); // this command takes ~500ms
flag_timer_interrupt = 0;
}
}
-------------------------------------
I'm looking for a way to have the PSOC respond "immediately" to the computer because you can imagine the delay if I ask for data while it's updating the values.
I've tough about parsing and sending the data in an interrupt, but I also read it was not recommended. I also had an idea to an algorithm like that but it doesn't look efficient/beautiful in my opinion:
while(1)
{
update_one_value();
check_and_parse_usb();
}
Do you have any idea if either it is possible to run the function in parallel or what I could try to implement to have a more efficient algorithm.
Thank you for your time,
Alex
Show LessHi,
I'm using a PSoC 5LP and FreeRTOS. I developed an app that is working. I tried to add a WDT service as a separate task. The task never appears to clear the WDT and therefore goes into RESET constantly. Am I missing something?
Code frag:
WDT_DELAY 2000 // the delay between 'petting' the WatchDogTimer
wdt_task(void *arg)
{
CyWdtStart(CYWDT_1024_TICKS,CYWDT_LPMODE_DISABLED);
for(;;)
{
CyWdtClear(); // 'pet' the WDT
vTaskDelay( pdMS_TO_TICKS( WDT_DELAY)); // delay before the next 'petting'
Pin_LED_BLUE_Write(!Pin_LED_BLUE_Read()); // Toggle the LED for visual indication
}
}
main()
{
...
xTaskCreate(wdt_task,"WDT_TASK",50,NULL,5,&wdt_task_handle);
...
}
Show Less