Good morning, everyone. That’s my concern. We are working with Psoc on an automatic night light project. We have the HC-SR04 ultrasonic sensor at our disposal. On Arduino, I have no problem programming this sensor, only I am starting on Psoc and I have a lot of trouble understanding. I am working on the CY8C5888LTI-LP09768-QFN kit. My goal is simply to display on the LCD a number of passages in a corridor. I set 70cm for the measurement trigger, that is, the "Trigger" pulse starts when a movement is detected at less than 70cm, and starts the measurement. I have a constraint that the pulse should last 10us. When I get to that level, I don’t know what else to do... I tried to use a timer, but no result, also a counter but no result either. I am attaching two datasheet of my sensor in question.
Thank you in advance for any help.
I am a little confused with how to switch a PSOC 3 device from the default 4-wire JTAG to the SWD interface for programming / debugging.
From reading over the psoc 3 device programming spec (https://www.cypress.com/file/44676/download) it makes me believe that I have to toggle the TCK and TMS pins in a specific pattern each time to go from JTAG -> SWD. It is my understanding that the NVL's would not change and the device would simply re-enter 4-wire JTAG after a hard reboot.
When I read over the PSOC 3 datasheet (CY8C34), it states that all I would need to do is update the DPS nonvolatile latches to be 10b. It seems that this would have to be done via another tool "cyhextool" and with the mini prog 3 only (my interpterion of reading the help files, makes me believe this is another way to accomplish this).
Since PSoC creator generates the hex file needed to update my program, and unless I am missing something (or don't understand intel hex file format), couldn't I just edit the fields within PSoc Creator, have it generate the hex file and upload it via PSoC programmer with a miniprog3?
Thanks,
-n8
Show LessI have successfully created a joystick button HID device using a PSoC 1. It actually emulates 2 joysticks for a total of 56 buttons, which I use to interface with a pinball machine to read switch inputs from the playfield. I'm using this connected via USB to a Windows PC.
It has one problem - I have to toggle an input before Windows reads any of the button values. For example, in a normal pinball machine the balls are already pressing down on certain switches when you turn on the machine, plus some switches are normally closed and they open on triggering. So at power on, out of 56 joystick buttons there might already be 5-10 buttons that are being pressed.
The problem is evident in the Windows configure USB gamepads tool, which let's you observe the current button states. When I first open it up, it shows no buttons as being pressed. I press any button at all, and this somehow wakes up the readout, and now I see all the various buttons registering presses. But it gets worse - after a while of no use the button readouts seem to go to sleep again. This is a problem in any typical robotic type implementation, where you need to read button presses at startup before you start making movements, otherwise something could be damaged.
I've seen a similar sleepy behavior in consumer programmable HID devices. In fact, this was one of the reasons I decided to create my own HID solution, as a commercial developer said they were too busy to fix this issue.
I'm at a loss as to how to fix this. Originally in my code I only sent the button readout if something changed. I modified this to send a button state every 100 cycles regardless, thinking this would solve the issue, but it had no effect.
My actual code is longer to address all 56 buttons. The shortened version below shows the exact same logic for the first 8 buttons - the omitted code is redundant.
What I'm most confused about is how triggering a GPIO input somehow wakes this up. I don't see how that does anything that my Counter1 variable isn't also doing by forcing a data transmission. Is my code getting hung-up on one of those while statements? Does triggering a input somehow force an interrupt that resets my code execution?
I've looked through the USBFS datasheet, and a few things piqued my interest. USBFS_Force talks about remote wake-up functionality. USBFS_UpdateHIDTimer talks about resetting an expired HID timer. And the USB_TOGGLE parameter option on the USBFS_LoadInEP sounds like it could prevent packet loss. But I fear I'm grasping at straws.
Any help would be greatly appreciated!!!
Paul
//----------------------------------------------------------------------------
// C main line
//----------------------------------------------------------------------------
#include <m8c.h> // part specific constants and macros
#include "PSoCAPI.h" // PSoC API definitions for all User Modules
BYTE GP1Buttons[1];
BYTE Data1ChangeFlag;
int Counter1 = 0;
struct { BYTE Report_ID; BYTE Buttons[1]; } GamePad1Report;
#define GAMEPAD1_RPT_LENGTH (sizeof(GamePad1Report))
void main(void)
{ OSC_CR0 |= 0x20; //Sets the No Buzz bit in the OSC_CR0 register to keep the bandgap enabled during sleep, improving resume from sleep/wake-up performance
// Enable global interrupts
M8C_EnableGInt;
GamePad1Report.Report_ID = 1;
// Start USB and wait till enumeration complete
USBFS_Start(0, USB_5V_OPERATION);
while(!USBFS_bGetConfiguration());
USBFS_LoadInEP(1, (char*)&GamePad1Report, GAMEPAD1_RPT_LENGTH, USB_NO_TOGGLE);
// Enable Pull down resistors on All Ports
PRT0DR = 0;
PRT1DR = 0;
PRT2DR = 0;
PRT3DR = 0;
PRT4DR = 0;
PRT5DR = 0;
PRT7DR = 0;
while(1)
{ ++Counter1;
/*BitShift the PSoC Port Bits to map them to Chameleon IO Gamepad Button Groups*/
// Buttons[0] = PRT4DR & 0XAA | ((PRT3DR & 0XAA) << 1);
GP1Buttons[0] = (
((PRT4DR & 0X80) >> 7) | // 10000000 > 00000001
((PRT4DR & 0X20) >> 4) | // 00100000 > 00000010
((PRT4DR & 0X08) >> 1) | // 00001000 > 00000100
((PRT4DR & 0X02) << 2) | // 00000010 > 00001000
((PRT3DR & 0X80) >> 3) | // 10000000 > 00010000
((PRT3DR & 0X20) ) | // 00100000 > 00100000
((PRT3DR & 0X08) << 3) | // 00001000 > 01000000
((PRT3DR & 0X02) << 6)); // 00000010 > 10000000
//Check if any buttons have changed
if( (GP1Buttons[0] != GamePad1Report.Buttons[0])
|| (GP1Buttons[1] != GamePad1Report.Buttons[1])
|| (GP1Buttons[2] != GamePad1Report.Buttons[2])
|| (GP1Buttons[3] != GamePad1Report.Buttons[3]) ) Data1ChangeFlag = 1;
if((Data1ChangeFlag) || (Counter1 > 99)) {
Data1ChangeFlag = 0;
Counter1 = 0;
GamePad1Report.Buttons[0] = GP1Buttons[0];
while(!USBFS_bGetEPAckState(1));
USBFS_LoadInEP(1, (char*)&GamePad1Report, GAMEPAD1_RPT_LENGTH, USB_TOGGLE);
}
}
}
Show Less
Hi,
I have bought this kind of Psoc due the troubles to get pieces in common distributors that I need(3666AXI), in these crazy days...
Psoc Creator has in device selector Cy8c3665AXA-010 ( not AXI) and I can't programm it.
Is it this feature the trouble?
It takes a message in which I have to enable debug mode...
Thanks.
(I'm desperate with obtain pieces...nobody has this problem?)
PSoc Programmer log.
Only detect in mode JTAG
| FAILED! Can not enter Debug Mode of PSoC3 device
| Please, check the following items:
| - the connection between the programmer and the PSoC;
| - the correct programming protocol is selected;
| - the correct connector option is selected.
PsoC Creator
Show Less
I am trying old code which written in psoc-1.0 to latest version and getting these errors.
Starting MAKE...
creating project.mk
name translation failed on C:/PROGRA~1/Cypress/Common/CY3E64~1 - 3
lib/accr_adc.asm
lib/accr_adcint.asm
CAUTION lib/psocconfig.asm is older than PSoCConfig.xml or missing
CAUTION you may need to generate source in PSoC Designer
lib/psocconfig.asm
lib/psocconfigtbl.asm
lib/psocgpioint.asm
lib/pwm8.asm
lib/pwm8int.asm
lib/timer8.asm
lib/timer8int.asm
!E C:\Users\LENOVO\DOWNLO~1\MANOJS~1\BIKE_T~1\BLDC~1\BLDC~1\commutation.c(26): illegal expression
!W C:\Users\LENOVO\DOWNLO~1\MANOJS~1\BIKE_T~1\BLDC~1\BLDC~1\commutation.c(26):[warning] expression with no effect elided
!W C:\Users\LENOVO\DOWNLO~1\MANOJS~1\BIKE_T~1\BLDC~1\BLDC~1\commutation.c(26):[warning] expression with no effect elided
!E C:\Users\LENOVO\DOWNLO~1\MANOJS~1\BIKE_T~1\BLDC~1\BLDC~1\commutation.c(26): syntax error; found `252' expecting `;'
!W C:\Users\LENOVO\DOWNLO~1\MANOJS~1\BIKE_T~1\BLDC~1\BLDC~1\commutation.c(26):[warning] expression with no effect elided
!W C:\Users\LENOVO\DOWNLO~1\MANOJS~1\BIKE_T~1\BLDC~1\BLDC~1\commutation.c(86):[warning] [MISRA 2712]old-style function definition for `Switch_PWM'
!W C:\Users\LENOVO\DOWNLO~1\MANOJS~1\BIKE_T~1\BLDC~1\BLDC~1\commutation.c(410):[warning] [MISRA 2712]old-style function definition for `glitch_delayinus'
make: *** [obj/commutation.o] Error 1
BLDCMCON20 - 3 error(s) 5 warning(s) 16:57:39
Hi All, we are a start-up with a renewable product and have designed around the above chip. Unfortunately with all the supply upheaval we can't find any of these chips for our first production run. If anybody can help or knows where we can get 20 or even 10No. I would be very grateful. Thanks, Kieran
Show LessI have uploaded a new Digital Comparator component (DCmp) that is almost as fast (1/2 BUS_CLK frequency) as the Infineon version but uses significantly less PSoC resources. It also can perform SIGNED comparisons!
DCmp-V2-0-component-Upgrade-to-DCmp-with-optional-HW-inputs
Here's a quick look at some of the features compared to the Infineon component.
Method |
Infineon Digital Comparator |
CONSULTRON DCmp |
Input load |
HW |
HW, DMA or CPU |
Threshold load |
HW |
DMA or CPU |
Number of simultaneous inputs |
1 |
1 or 2 |
Number of simultaneous comparisons |
1 |
1 or 2 |
Simultaneous comparison outputs |
1 HW |
1 to 6 HW types |
Data Widths |
1- to 32- bits |
1- to 32- bits |
Comparison output glitch filter |
No (async) |
Yes (load signal sync) |
Relative PSoC resource allocation* |
>=(1/3)x@8-bits >=(2/9)x@16-bits >=(2.5/13)x@24-bits >=(3/17)x@32-bits |
(1/1)x @ 1- to 8-bits + 1 Datapath |
Relative Comparison Speed |
Fastest (async) (~10ns) |
Extremely fast using HW(1/2 BUS_CLK cmps/sec) Very fast using DMA (>4M cmps/sec) |
Signed comparisons |
No |
Yes |
Check it out.
I suggest this thread be used to share ideas how to use this component in creative ways.
Show LessThe motor should be run up and down 1000 times and on each run the limit switch must open and close again. Depending on the test result, a red or green LED should be switched on.
The following task has to be implemented.
1.If end position LOW - motor drive down till end position HIGH
2.If even after 12s the endposition it is still low, the red LED should be turned on followed by end.
3.If the end position within 12s is high, the motor should run 1000 times.
I have already implemented two output pins for the motor up and down positions, one for end position, one for green led and one for red led.
Please guide me how can i proceed with this task. I have never worked with Psoc, this is first time. I highly value any suggestions you provide me.
Show Less
The motor assembly includes a limit switch that operates in both the top and bottom positions
also switches in the lower end position (closed in the end positions, during the
Motor drive open).
The first task:
The motor should be run up and down 1000 times and on each run the limit switch must open and close again. Depending on the test result, a red or green LED should be switched on.
I have already defined my macros
#define LOW
#define HIGH
#define LED_GREEN_ON LedGreen_Write(HIGH);
#define LED_GREEN_OFF LedGreen_Write(LOW);
#define LED_RED_ON LedRed_Write(HIGH)
#define LED_RED_OFF LedRed_Write(LOW);
#define MOTOR_UP {MotorDown_Write(LOW);\
MotorUp_Write(HIGH);}
#define MOTOR_DOWN {MotorUp_Write(LOW);\
MotorDown_Write(HIGH);}
#define MOTOR_STOP {MotorUp_Write(LOW);\
MotorDown_Write(LOW);}
#define READ_END_POS EndPosition_Read()
Please help me in approaching this problem. I have to use psoc creator.
Show LessBuenas noches, quisiera tener una asesoria respecto al uso del IDAC en Psoc 5LP. Estoy revisando la documentación para usarlo como fuente de corriente para usarlo para medir temperatura de una PT100. Segun esta en la documentación, cuando se usa la salida de corriente en el rango de 0-2048 uA, solo pueden usarse 4 salidas, que dejo adjuntas. Mi pregunta es, ¿puedo utilizar algun otro pin como salida del IDAC para usarlo con la PT100? y tambien, ¿puedo crear más de un bloque de IDAC dentro del proyecto para usarlo con varias PT100 al tiempo?
Gracias
Show LessUser | Count |
---|---|
544 | |
262 | |
228 | |
195 | |
127 | |
87 |