I have to compare a Digital output from an ADC with a Digital constant in a Digital comparator. How can i transfer my Digital output from ADC to a Digital comparator?Show Less
In electro-tech-online I asked about my need of making a device wich could generate a sinusoidal signal (by PWM method) with a 18F4550 Ucontroller, but it seem it is not possible. Someone named Dana suggested me to see the information about this cypress device. So, the questions are:
1. Is it possible to make a threephasic 5 KHz signal (3 120 degrees unphased signals), wich could be used by a power stage to handle about 1 ampere each branch in some kind of power transistors?
2. If the signal is analog, is it a way to isolate the control stage from the power stage?
3. Is it possible to stop or restart this signals with a Ucontroller signal? Or further, to control amplitude?
4. Do this device is sold and there are existences now on Mouser, Arrow or DigiKey?
Thank you for your time
I thank very much to Oddisey1 who has been orientating me, but for now has not time to help me. In the time of this project, I buyed the CY8CKIT-059 PSoC 5 -LTI- 059 and some ' Motor control shields with IFX007T' . The last didn't work for me as they don't achive the 5 KHz, but anyway will be useful in the next project: an inverter. For now, I'm told to dive in the project : "DMA 3phase_VDAC_01b_basic-000.cywrk.Archive01.zip" So I downloaded it, but It is the first project I'd run with a PSoC (I had some experience with PICs and had seen several videos of PSoC implementations, as https://www.youtube.com/watch?v=F2qlRSR2ofs), and the project DMA 3phase is there, but has not an explanation for beginners with PSoC. Initially, I can see the project on PSoC Creator 4.2 now installed on my computer.
So, is there someone who could exlplain me the components of this project? I know that I have to read what each component does, but I don't know why are they configured or connected as they are, or why these program components are there, or HOW CAN I ADAPT THIS TO MY PROJECT (this last question is the only one really important, the rest can be let for later revision), which for now is just to generate a 3phase about continous sinus signal at about 5 KHz, tunnable, not feedback (not a motor). That is just what I need to solve. Later I'll see power stage.
Thank you for your help
In PSoC 101: Lesson 16, the CySysPmSleep() API doesn't take any arguments whereas when I am trying with PSOC Creator 4.4, there is no CySysPmSleep() API, but instead a CyPmSleep() API which requires two arguments (Wakeup Time, Wakeup source).
I have gone through the inbuilt Sleep_Timer_Wakeup example which makes use of a special Sleep_Timer component (I think)... and also tried using the CyPmSaveClocks() and CyPmRestoreClocks() API's before and after calling the CyPmSleep() API --> The device goes to sleep, but doesn't wakeup.
Can anyone help understand how to bring the same functionality of Lesson 16, using a user-defined timer to the sleep project?
Similarly in Lesson 17, the deep sleep mode is achieved using the CySysPmDeepSleep() API (which is not available), and so i tried using CyPmHibernate() (similar to the PowerManagement_Hibernate example firmware), but when trying to write to the i2cbuf from the Bridge Control Panel application, the Slave is NACKing the commands --> Failure.
Please help on how to implement these examples with CY8CKIT-059 and PSoC Creator 4.4.
I was planning to perform square wave voltammetry on a three-electrode configuration system. In square wave voltammetry, a symmetric square wave is superimposed with a staircase potential and then applied to a stationary electrode. I have decided to choose the PSoC 5LP board for this purpose. Therefore, can anybody provide any feedback or suggestions based on this? Is this board feasible to perform the experiment?
Thanking youShow Less
Background info for my question:
I am an amateur/hobby circuit designer (self taught), so apologies in advance. Also sorry for the long post. I have many skills, but brevity is not one of them.
I've designed a pinball lighting control circuit board. When I originally spec'ed out my requirements, and searched for components, the PSoC 1 rose to the top of my list. Many may think the PSoC 1 is not the best choice for this application (and they're probably right), but at this point I'm too heavily invested in time and money to do anything different.
I'm using the PSoC 1 with 56 GPIO, and configuring all 56 as LED outputs. I will say that my main goal is 100% achieved, I have a working solution that meets my original objectives of directly controlling all 56 outputs without matrixing, and minimal latency, and decent PWM for LED's (good enough for pinball, anyway, though a little less flicker would be a nice-to-have). Not only that, but my self-designed board is significantly cheaper than the commercial options that are available, so win-win even if my PSoC 1 choice was ill-conceived.
These same LED outputs are also optionally used to control a separate Power Driver board, allowing me to turn on/off pinball solenoids just like turning on/off an LED, except I don't use PWM for those signals, just on/off.
Keep in mind that for my following questions, each of the 56 outputs needs to be individually controllable for on/off and PWM duty cycle.
It was only after I designed my pinball lighting solution that someone asked if I could use it to control servos, and at first I thought sure, absolutley! But upon further inspection I don't think the PWM performance is high enough for accurate servo control, bringing me here.
Question 1: Hardware PWM vs. Software PWM?
I know the PSoC 1 can be configured with hardware PWM by using a digital block. But even with only 8-bit PWM, I have to dedicate a full digital block to PWM calculations. And best I can tell, I can only drive 1 GPIO individually with hardware PWM. I did see some options for using one PWM signal to drive multiple pins, but it seems like this needs to use shared PWM duty cycles, so this wouldn't allow me to individually control multiple GPIO using a single PWM digital block.
Am I correct? So a software PWM solution is the only option if I need 56 GPIO individually valued?
My chosen PSoC only has 4 digital blocks, so I quickly settled on software PWM, but I'm wondering if I misunderstand how best to leverage the PSoC 1's capabilities.
I would love it if there was a way to use a digital block to improve PWM performance for all 56 GPIO simultaneously, but while maintaining individual addressability.
Question 2: Software PWM Performance?
After significant code refinement, I have gotten my software PWM performance up to a staggering 8Hz (laugh), using 64 PWM levels (6-bit), while setting all 56 pins on each pass.
To provide a bit more detail: my software does 64 loops through the on/off settings for each PWM Period, and is able to complete 8 Period loops in 1 second (8*64 = 512 total loops per second). And it is doing this for all 56 GPIO, so technically it's processing the on/off state at a rate of around 28,672/GPIO Pins per second.
8Hz is pretty low. Like I wrote above, this is good enough for basic pinball lighting, and triggering solenoids on/off, but a bit slow for more advanced RGB lighting, and way too low for servos which commonly need around 50Hz. Also, servos need very fine pulse duration control often measured in fractions of a millisecond. My smallest duration right now is around 2ms, far too long to control servos. Even if my basic loop was magically running 6x faster at 50Hz, I don't think the duration control is fine enough for servos, and would require a hardware PWM implementation for adequate control.
So does the performance I'm achieving sound reasonable for a PSoC 1? Somehow I thought a 24MHz processor would be a little faster. It seems my code is taking 837 cycles per pin to process my code, which seems high to me.
The PSoC 1 Clocks and Global Resources documentation states that M8C assembly language instructions take between 4 and 15 cycles of CPUCLK to execute. I'm using C, not assembly, so I'm not sure if C has a performance overhead. For each GPIO, I use each GPIO's target PWM level (0-64) to query a 65x65 constant array of predetermined 6-bit PWM values, then use GetState to compare if the new On/Off state is different, and if it is different then I issue the LED_1_On or Off Pragma command. That's it, the code is super simple, so I didn't think it would take so many CPU clocks to look up a boolean value in a 2-dimensional array and see if it is different than the current On/Off state.
It also seems that if I scaled back my grand ambitions from 56 GPIO to just 1, at best this would only be 56x faster, essentially a 448 Hz software PWM solution for 1 GPIO.
Since I need 56 PWM LED outputs, I've never tested the digital block to see how fast that PWM solution performs, though I'd wager it's quite a bit faster. Still, 448 Hz for a single 6-bit software PWM coded GPIO seems pitiful.
Question 3: Best Practices for Accessing GPIO - Registers vs. Pragmas?
In my early test code, I was directly accessing the GPIO using the registers, like PRT4DR, thinking that would be fastest. But I've since changed to using Pragmas, like LED_01_Start, LED_01_On or LED_01_Off. From my tests, it seems performance is the same, and the Pragmas make for easier coding. Am I wrong?
Similarly, I was originally setting the GPIO ON or OFF on every pass, even if there was no change from the previous pass. I refined my code to only set the state if it had changed, and this seemed to boost performance. I started with an array of 56 booleans to track the On/Off states manually, but then started using the LED_01_GetState instead, and this Pragma seemed to have no adverse effect on performance. The only downside I discovered to using GetState is that it only reported correctly if I used the Pragmas for On and Off, otherwise it returned the wrong value if I set On/Off directly via registers.
Am I right that Pragmas have no performance impact, and possibly even memory benefits since I don't need to track and array of on/off states in my code?
Question 4: Can I Set All GPIO with 1 Command?
In my software PWM solution, I am stepping through each GPIO, one-by-one, to set their On/Off state (but only if it has changed). This seems really inefficient. In a worst case scenario of a 50% duty cycle, I'm flipping each GPIO's state with every pass, one-by-one.
It seems it would be more efficient if I could pass a single command with 7-byte value that represents the on/off state of all 56 GPIO.
I couldn't find any commands like this. Perhaps I'm overestimating the potential impact, as in my testing it seems that my code sets 1 GPIO at the same rate as all 56 GPIO, so perhaps toggling the GPIO state doesn't have much of a performance penalty. I guess this makes sense, as I would expect the PSoC to be highly optimized for setting the GPIO states. But if I could eliminate a loop through all 56 GPIO one-by-one, perhaps PWM frequency would improve due to code efficiency.
Question 5: Best Global Resource Settings?
Performance is my main concern for this device. Low latency is #1, followed by higher PWM frequency. For that reason, I've pretty much maxed out the Global Resource settings (or, at least I think I have maxed them out). But I understand that some of these settings consume more power without any benefit to my device, so minimizing wasted power drain seems wise if possible.
Below is what I've configured, and my reasoning. Does this look right?
Power Setting is set to 5.0v / 24MHz - I believe this is the fastest option.
CPU_Clock is SysClk/1 - I figure this is what is controlling my code speed, and that this is the fastest clock.
Sleep_Time is 1_Hz - I'm never "sleeping" in my code, it simply runs my simple loop forever as fast as possible, no delays, so I'm not sure if this has any impact at all for my purposes. Though perhaps I'm confused how this affects performance and it is slowing down my code execution by waking up the CPU every 1Hz!!!
VC1 is set to 16 - I don't see any performance difference vs. setting VC1 to 1
VC2 is set to 16 - I don't see any performance difference vs. setting VC2 to 1
VC3 is set to VC2/16 - I don't see any performance difference vs. setting to 1. The documentation indicates I can set this lower than VC1/2, going as low as 256. Should I change this to 256 for lower power drain? Diminishing returns?
SycClk Source is set to Internal - I'm using the built in IMO, not an external crystal solution
SysClk*2 Disable is set to No - I don't think the SYSCLK Doubler affects software PWM, as I don't think software code is able to take advantage of the special 48MHz clock timings that are available to the digital blocks, so I thought I should set this to Yes for more power savings. But every time I set it to Yes, the PSoC 1 failed to connect properly through USB. Perhaps that indicates a hardware issue, but leaving it set to No works just fine, even though this seems like a higher performance setting.
Analog Power is set to All Off - I originally was the default of SC On/Ref Low. All 56 GPIO are using the LED module configured to Active High. Since I'm using digital IO, my assessment is that these Analog Power settings don't apply to me, and it seems to behave the same with the All Off setting, which should have the least power drain.
Ref Mux is set to (Vdd/2)+/-BandGap - This too seems to be related to Analog Power for use in Analog Blocks, so I'm thinking this value has no impact at all for my design.
AGndBypass is set to Disable - This seems to be related to Analog Power's Ground, for use in Analog Blocks, so I think this has no impact on my design.
Op_Amp Bias is set to Low - Another analog setting that doesn't apply to my design?
A_Buff_Power is set to Low - And another analog setting that doesn't affect my design, right?
Trip Voltage [LVD] is set to 4.81V - The fact that my tests are operating without restart hiccups suggests that my USB 5V power delivery is working correctly, otherwise I would expect even minor voltage sag to cause restarts with this being the most aggressive setting. Side note, this is the 2nd revision of my design. My 1st design used an external power source shared with the LED's, and lighting more than a handful at once caused enough voltage sag to trigger a PSoC reset. I'm now using USB power for the PSoC, and separate power planes for my LED's, and I'm ecstatic that it's working well.
LVDThrottleBack is set to Disable - Combined with my take on the LVD behavior, I think this suggests that I am successfully running at 24MHz, and not scaling back to 12MHz due to low voltage.
Watchdog Enable is set to Disable - My understanding of the Watchdog is that it can check if the PSoC is hung, and restart it if it is non-responsive. Other than low software PWM performance, my board seems to be working flawlessly, even without the Watchdog enabled. I'm thinking that I might need to set this to Enabled for a production version of my design, to make it more reliable for end-users, but I'm not sure if that's the right way to think about this feature. But since I have a software loop that runs non-stop forever without sleep, I'm not sure that this even gives the Watchdog an opportunity to be effective.
Question 6 - What am I overlooking?
Sorry to be so greedy for input, but I thought it wise to ask the most general of questions - what am I completely overlooking?
All I need is for the PSoC 1 to individually address all 56 GPIO with a PWM signal, at the highest possible frequency, and with the most accurate duty cycle period duration.
Should I be using timers? Interrupts? Assembly instead of C?
I have a very refined loop that simply updates all GPIO as fast as possible with the current On/Off state based upon predefined PWM values. The code occasionally checks if the USB buffer has new PWM data to process (this is a tiny 56 byte record), a query that I've varied from once per PWM Period to 64 times per period with no discernable impact. I'm currently checking the USB buffers for data once every 2 PWM periods, approximately 256 checks/sec, or every 4ms. This is to keep latency low for my pinball control software.
Because it is simply running a loop as fast as possible, I didn't see a need for timers or interrupts, even though these would be typical in a PWM solution. I do understand that my timer-less approach leads to some performance variability, though it seems consistent enough as the processing load is essentially the same with every loop.
You made it to the end!
If you actually read everything above, you're awesome! Thank you! Hopefully you have some good advice to share back my way...
If I need to post code, let me know.
dual USB components on MAC OS
We have made a product with a PSoC5LP.
The PSoC5LP displays 2 interfaces after the USB enumeration phase.
1) a basic USB component
2) a CDC (a USB to serial COM)
view provided by PSoC Creator:
- The product is well detected under Windows OS:
- The product is well detected on a Rapsberry. I use the following shell commands to install it:
We can open/write/read/close the new serial easily with basic program.
- The product is "seen" by on MAC OS. The device appear into the list of USB device. However, the device isn't detected like a CDC or serial com port. I'm looking for a similar commands found for raspberry to indicate/force that my product is a CDC.
It seems that kextutil/ kextload/ ... might be the right solution.
Have you encountered a similar problem on your side? How did you install the CDC on the MAC for a custom product?
Because, on a kitprog, the virtual COM port is well detected.
I am trying to get a CY8CKIT-059 PSoC 5LP up and running on Windows 10. Unfortunately, after getting everything installed, the device will not appear as an available Debug Target in PSoC Creator 4.2, and I am getting pretty frustrated! Here are the steps I followed:
1.) Run the CY8CKIT-059 Kit Setup installer linked from the device page on cypress.com. Image of download link follows. This installs Creator 4.2, Programmer 3.27.1, and all the support files.
2.) Plug in the device (with "snap off" programmer attached) and check Device Manager. The install of drivers was successful because I see the device correctly recognized under the Ports section. See image.
3. Launch PSoC Creator and create a new project targeting this device model and using the HelloWorld_Blinky1 example app. Image attached of the device I chose when starting the project.
4.) Attempt to Program the device. Here's the trouble: The dialog where I would choose a target is blank! See image.
The Creator is making *some* kind of recognition here because when I attempt this again after UNplugging the device, message appears in that same window saying "Port Aquire Failed, No Devices Detected."
I have tried uninstalling all software, restarting Windows, reinstalling, and restarting again before plugging in the device and opening the app, nothing changes.
I have also tried manually updating the drivers to "KitProg2 USB-UART" which come with the software install. No difference.
I have also tried running the Creator Update Manager and updating everything possible, which were an update to the Programmer and a download of Creator 4.4. Neither of these updates changed the outcome 😞
Just in case it matters, here's an image of the About box in Creator:
I am running Windows 10 on a MacBook Pro with BootCamp. The machine only has USB-C ports so I am using a USB-C male to USB-A female adapter. Could this be a problem? I wouldn't think so. When I plug in the device I get solid green and orange lights on the programmer, and blinking blue light on the device.
Any advice would be greatly appreciated! Getting really frustrated over here!Show Less