PSoC™ 4 Forum Discussions
Hello Cypress community!
I recently started experimenting with the CY8CKIT-042-BLE (CY8C4247LQI-BLE, to be specific) for a small R&D project in the office. Without going into too much detail, we're trying to accurately measure the resistance of a variable resistor. In particular, I'm measuring the resistance of 9 separate resistors in this application.
I've attached the Project file I've managed to cobble together that seems to work at the moment (please excuse poorly written code and badly configured diagrams, still new here). I've declared the proper analog pins that one end of the sensors are connected to, while the grounded end of all the sensors are connected together to GND on J1. The TopDesign.cysch connects the sensors to an AMux, which uses a combination of the IDAC and ADC blocks to inject a small amount of current to each of the analog pins, and then ADC measures the voltage drop across each resistor. From this, I can take the known current and measured voltage and (V = IR) calculate the resistance of the sensor at that point in time.
There's a little more to the design file, but most of it is to 1) accurately timestamp the collected data, and 2) create a UART connection such that I can print the values over terminal and capture them to a text file on my PC.
Okay, a couple important questions:
1) What is the maximum voltage I should expect into the ADC? The ADC block had Vref connected to VDDA, and the single-ended negative input is also set to Vref. This sets the "Single ended mode range" to "Vdda (3.3 V) to 0.0", and, when I disconnect the sensor entirely from the board, I see 3.301643 volts printed to the terminal (open connection). I know these are quite close, but they're not quite the same. Is this discrepancy normal?
2) I've got the ADC configured to be 12-bit, which should be 4096 counts full range. When I increase the resistance of my sensor, I can get it as high as ~8200 counts, which just exceeds 13 bits. Do I have my ADC configured incorrectly?
3) I've noticed that occasionally some of the voltages reported by the ADC for an individual sensor will "blip" up by a few 1000 counts before coming back down to the nominal level of the other sensors. I've reached out the sensor vendor, and after confirming that I've connected a battery to the kit to stabilize the board voltage (it was just powered off the USB cable before) they've commented that something could be going on with the inherent capacitance of the ADC relative to the timing of my ADC readings. Does anyone have any insight into how I can quantify this and change my timing to accomodate?
Apologies for the long read, any comments are greatly appreciated! If this is posted to the wrong section please point me in the right direction.
Thank you!
Show LessIn Cy8c4247,is there the API to get wakeup source when MCU was waked up from Deepsleep?
Hi All,
I am using a CYBLE-202007-01 module. Every once in a while, after sending a BLE message, the node will stop responding to messages. If I take a look on my CySmart phone app, I can see that my module is no longer advertising. I have come to find that it gets stuck in Gap Central.
If I send a message every 30 seconds or so, the issue of getting locked in Central is less frequent, per amount of messages sent.
To prove that I was stuck in Central, I coded in a change of LED lights that would only occur if I was in GAP Central for more than 10 seconds. If anything, I should never be in Central for longer than 3 seconds.
I have to wonder if the BLE device is failing to disconnect my Android device properly. I have been programming in Android for years, and I know my connect/disconnect on that side is solid. Just in case I was wrong, I followed all of the connecting/disconnecting events in my Android logs to ensure this. I went further to write some extra Android code to list all my connected devices, and when this "stuck in central error" occurs, my Android device shows that it is not connected to any devices.
On the BLE side, I am using the below to disconnect devices.
if((cyBle_connHandle.bdHandle != 0)){
CyBle_GapDisconnect(cyBle_connHandle.bdHandle);
CyBle_ProcessEvents();
}
Though, i've also noted CyBle_GapDisconnect(0); to work as well
Is there a way to recover from being stuck in Central? I'm sure there is some type of error when the node fails to disconnect properly and the BLE node won't switch back to being a Peripheral (and restart advertising). I would even be willing to reset my system to it's initial state, but I haven't found that to be possible from my searching.
Show LessI've used the BLE_4.2_DataLength_Security_Privacy example almost verbatim on the Peripheral-side, and, after dabbling a bit on the Central-side, have gotten the 2 (both PSOC4 Modules) to Connect->Auth->Bond with each other. Now, however, just like the Example, I want the Peripheral to Directly advertise with a RPA.
I'm pretty sure the criteria is correct there, so, since I don't have an example for the Central-side, I'm assuming there is something I'm missing in that code.
What's happening is that a CYBLE_EVT_GAPC_DIRECT_ADV_REPORT is not even hitting when the Peripheral advertises. Since its direct and RPA, no device, CySmart dongle or other, is catching the Peripheral, but the Central is scanning other floating devices, so I'm sure scanning is working.
What API functions need to be called on the Central, during/after pairing/bonding, to ensure LL Privacy is implemented correctly?
Troubleshooting Update:
A little additional Info (Some may matter, other highlights FYI):
- The Central is a Central/Peripheral setup, though broadcaster only as of yet.
- After StoreBond, both devices would update information within their local Device Information service. At first, I would call CyBle_StoreStackData, but the, on only the Central-end, I would get a CYBLE_HCI_COMMAND_DISALLOWED_ERROR. Figuring it must be that, I took CyBle_StoreStackData out, with no luck, then I called CyBle_Stop() and restarted the stack after 'Bonding Mode' was complete. I know I shouldn't have to do that, but didn't know what I was calling the cause the vague error. I'm disconnected for the CyBle_StoreBondingData(), so the only command was StartAdvertisement.
- I tested a CyBle_Stop/Start call on the Peripheral end as well to see if it would resolve any issues, but all it did was wipe out any RPA it constructed when it went into and came out of Low Power Mode.
UPDATE 2: Central Module is CYBLE-202007, and after reading up, I'm now doing a soft reset on just that end after the bonding procedure is complete. On re-initializing, Bonds read up fine, and scanning/advertising starts up as well. Now, the major issue is what it has been all along: Peripheral is Directly advertising, Central does NOT see it. Central has been catching Direct Advertisements from other devices within range. No addresses in the advertisement package is related to either device. I'm not sure if that should happen, since I've always assumed CYBLE_EVT_GAPC_DIRECT_ADV_REPORT was only hit when the device was being advertised to directly and only on that device.
Show LessI have a project I am working on where I need to interface via I2C or SPI to 3.3v device(not 5v tolerant) and also have some GPIO that is 5v.
I have CY8CKIT-049-42xx kits as well as CY8CKIT-059 kits to work with. I am fine with having to snap off the KitProg once programmed, if necessary. I am fine powering the board with either 3.3v or 5v whichever is easier to work with.
I have read thru a lots of posts and the GPIO and other cypress notes. It looks like the PSOC5LP might be able to do this via VDDIOX pins, but they seem to be all joined on the CY8CKIT-059 kits. I did find a few articles of running the whole board at 3.3v, but I also need a number of 5v GPIO's.
I can't really find anything on the CY8CKIT-049-42xx kits on 3.3v operation.
Any thoughts would be appreciated.
Thanks,
Chris
Hello, I am trying to send data through UART between two cypress devices and have them engage in 2-way communication based on what they send each other. Currently, I have one cypress sending data to the other one, but it seems to send data infinitely for some reason. I have specifically narrowed it down to the GattcWriteWithoutResponse API call located in App_UART.c. I have attached my project archive, any help would be greatly appreciated.
Show LessHello everyone,
I am working on a small project that requires an SPI interface between a PSOC4 and a NOR Flash (N25q128 or MT25QL128). After going over the datasheets both for the NOR Flash and SCB module, I noticed the following:
1) The NOR Flash uses rising edge to clock-in the data and falling edge to clock out the data.
2) The clock polarity settings for SCB module apply both for MISO and MOSI lines. I was not able to find how to specify clock polarity separately for MISO and MOSI
Are there any pre-defined modules in the PSOC Creator to handle this or I have to come create my own with shift registers etc? Just wanted to check if anyone had a similar experience before I spend time re-inventing the wheel. Any help would be appreciated.
Thanks,
Yevgeniy
Show LessSorry, I thought this would be a touch easier... following one of 5 or 10 different "examples", I believe I have this PSoC always in the fast blink mode.
I opened the ADC with Differential Amplifier example and got it to Build / Generate Application after realizing what the example meant by pin assignments. ... now, what exactly are the next steps to load it to the target? I really don't "get" opening bootlable and programming it with that (which is why I think it always starts as though you were holding down the button).
Also, the instructions say to connect P0[5] to P12[6] on header J8. J8 is the USB connector with D+ D- +5 and 0.
... going to be taking a PSoC5 home tonight and hope it isn't as difficult to get started. Alan Hawse, I challenge you to hire an EE college grad (ok to have embedded experience with anything other than Cypress) and then watch her try to get this cy8ckit-049 to do anything without having a Cypress employee walk through the process. I'm over 8 hours into your company's products and ChipKIT, Ti, and NXP at least made something happen for me in the first day.
Grumble grumble, don't even get me started on how ardweeny can make a button and their board do something in about 10 minutes. You've got like another 8 hours before I dismiss Cypress and for small projects, stick with the arduino pro minis. They might be inferior but at least telling them to do things only requires a BSEE grad with 3.73 GPA. 😛
Yaaay - as if stress from work isn't enough, the PSoC-049 is going to make me drink.
Chris
In trying to figure out what is happening in my PSoC4 BLE app, I found that it would be really useful to see what events were being passed to my event handler. Printing event numbers then leads to a tedious process of look up. So I wrote a Powershell script which will generate a c file which allows printing the event codes as strings. I figure other might find it useful, so it is attached. I am not a Powershell guru, so it is pretty simple. It does not understand #ifdefs, so you will generally need to edit the result.
The Powershell script is attached as ParseEnum.ps1. A sample output (with 3 entries removed by hand) is attached as debugEvent.c.
Show LessHI
In my Verilog program using PSOC I want to make an output value (1'b1)for posedge and another output (1'b0) for negedge of same clock .and these two output should come to same output continuously(like 1010101010). is this possible????
Show Less