PSoC™ 4 Forum Discussions
text.format{('custom.tabs.no.results')}
Hi everyone,
I am new to the cypress system and capacitive sensing.
I would like to use the CapSense proximity code to detect the presence of a small object (small conductive ball) 2 mm of diameter
I am using the CapSense_CDS_P4_Proximity example code
I have built the sensor simply by using copper tape as the sensing element and polyamide tape as the overlay as can be seen in photo below
The problem is I cannot detect the ball using the default automatic setting of the code since the charge of the ball is very small, compared to a finger.
I am not sure what parameters I need to tune in order to be able to detect capacitance from the presence of the ball over my sensor.
Moreover, if the sensor becomes too sensitive I believe I need to also shield it from external environmental objects that might cause some noise such as nearby objects. Thus, what would be the optimal shielding method in this case.
Your help is very much appreciated.
Thank you !
Show Less
Hello every one!
About PSoc4 I know how to detect Uart Rx Errors at Uart Interrupt time, BUT I can't find how to clear those errors.... what function I have to call.
(may be I don't have to do it, but it's not clear!)
Thanks
Luigi
Italy
Show LessHi,
we are using PSoC 4200 BLE in one of our products and we are trying to integrate Cypress code into our stack.
my question is, Can I use the BLE APIs to configure everything in the BLE programmatically without the GUI.
if no, what are the things that require the GUI, and is there a way to go around it?
as an example of what we are trying to accomplish, we like to add the services and characteristics programmatically, is it possible?
the reason we like to do so is that we have everything already configured in our stack and we are trying to build an abstraction layer for Cypress PSoC 4200 BLE to be directly integrated into our stack.
Regards,
Ali
Show LessIs there an effective S/W process to increase responsiveness when hitting the CapSense button multiple times at high speed?
The customer tried to change some of the settings.
Finger threshold
⇒ Lower
(The ON response is faster, but the OFF response is slower.
Not very effective.)
Noise threshold
⇒ Lower
(This works by reducing the rise in baseline on Touch.
Effective.)
Low baseline reset
⇒ Lower
(Faster resetting after Touch.
Effective.)
ON debounce
⇒ Lower
(It speeds up the process.
Effective.)
Filter(median/IIR)
⇒don't use it.
(He didn't feel the effect.)
Best Regards,
Inoue
Show LessHello,
Help me to decode IR NEC Protocol.
I am using cy8c4245-axi 438 as IR Receiver and TSOP IR Receiver.
How to decode raw code in one variable ?
Basically I will save raw code into one variable in psoc and whenever same signal comes it will compare with that raw code and if match, trigger high any gpio pin.
So from where to start ?
Thank You.
Show LessI wanted to do this, but could not find any reference (one way or the other) to being able to use the Parallel Input (PI) to the datapath as a constant for calculations with the ALU (e.g. add or subtract), so I decided to give it a try because this would be very helpful in one of the things I'm trying to do with UDBs.
The answer? Yes, you can use the PI as a constant! I have attached a simple project to demonstrate this (I did it on a CY8CKIT-049-42xx, you'll need to reconfigure the Bootloadable component with your elf/hex files for it if you try to compile it for the same target).
Since there's not a lot of documentation on using the PI, much less in this manner (I really couldn't find anything that mentioned using PI as a constant, but my search skills may not be 100%), I thought I should document what I did and share it with others. Following the general steps outlined in AN82156 "Designing PSoC Creator Components with UDB Datapaths", section A.5 "Project #5 – Parallel In and Parallel Out", I created a component symbol, added a parameter called "PI_Value" that I set to 5 as default, and created a blank Verilog file for it. The parameter constant was added automatically when the Verilog file was created from the symbol editor, fyi. I then used the Datapath Configuration Tool per the instructions in AN82156 and created a blank cy_psoc3_dp datapath instance in the Verilog file. In the tool, first enabled the PI_DYN bit, then set it to EN. I created two datapath instructions: one to add the value of PI to the value of A1 and then store it back in A1 (FUNC = ADD, SRCA = A1, SRCB = A1, A1_WR_SRC = ALU, and CFB_EN = ENBL... the last of which dynamically selects PI as the input for SRCA to the ALU rather than A0 or A1 when the static PI_DYN bit is EN), and the other to just pass the value of A1 through the ALU (with FUNC = PASS, SRCA = A1, SRCB = A1, CFB_EN = DSBL). My Verilog then just flips between the two states every clock. The idea was that the first state would add 5 to A1 every time it ran, and that's what it does (the second state does nothing, but I wanted to have something heading into different states to make it a bit more representative). To finish up the datapath configuration in the Verilog file, I made the following assignments: .clk(Clock), .cs_addr( { 1'b0, 1'b0, next_state } ), .pi(PI_Value), and .po(po), where next_state was a simple flip-flop "reg next_state;"). So .pi() was passed the constant I had defined at the component level. There's a bit of wiring around the Parallel Output (PO) because I have a little LED board I made so I could watch the state transitions on port P2[7:0] (and that's why the frequency is so slow as well... so I could easily count the binary to make sure it was increment by 5). Note, writing ".po({Out7,Out6,Out5,Out4,Out3,Out2,Out1,Out0});" also seemed to synthesize fine and saved that extra wiring and assign statements (I didn't test it out on hardware though). I was trying to emulate the style of AN82156.
So, there were two things I wanted to mention before wrapping up. The first is that the way PO works is not immediately clear from the basic datapath diagram that appears in a lot of the documentation (e.g. the TRM, Rev *H, Figure 16-6 "Datapath Top-Level"). The implication is that PI, A0, and A1 are multiplexed onto SRCA to the ALU, and that PO is connected to the SRCA connection itself (this is literally how it's drawn in that figure). That was one of the reasons why I initially made two different datapath states: because I thought that in the ADD state, since I was routing PI to SRCA, that I would see it on PO. I added the second state so A1 would be applied to SRCA and PO would then alternate between PI and A1 (I needed to see A1, but seeing the constant every second cycle was fine). It didn't work that way... all I got out of PO was the value for A1. I had to dig deep into the TRM to find the answer, but in section 16.2.2.8 of the TRM (Rev. *H) "Datapath Parallel Inputs and Outputs", there is another diagram (Figure 16-25 "Datapath Parallel In/Out") that shows the insides of the SRCA multiplexer. In this diagram, it is shown that there are two multiplexers: one that selects between A0 and A1 that feeds into a second multiplexer whose other input is PI. PO is connected to the output of the first multiplexer... so that PO can never see the value of PI, and even when PI is being used, PO will be connecting to either A0 or A1 only. Mystery solved. But ugh.
Lastly, there seems to be a couple of bugs in AN82156 "Designing PSoC Creator Components with UDB Datapaths", section A.5 "Project #5 – Parallel In and Parallel Out". It assigns two bits to a one bit register ("state"), and then suggest a non-blocking assigning of the PO value out of the datapath to the component's output:
// From AN82156 ... bugs?
reg state;
wire[7:0] po;
localparam STATE_LOAD = 2'b00;
localparam STATE_ADD = 2'b01;
always @( posedge clk )
begin
case (state)
STATE_LOAD:
begin
state <= STATE_ADD;
/* we must latch the PO value here, because in the next state PO is not valid*/
Parallel_Out <= po;
end
STATE_ADD:
begin
state <= STATE_LOAD;
end
endcase
end
But Warp would complain (rightfully so I think) when I tried it with my component, that Out7 through Out0 were "not a register type", and could not be assigned in that way. I may be doing something wrong (let me know if you know what it is), since I am no expert at this.
// Does not work!!!
wire [7:0] po;
reg next_state;
always @ (posedge Clock)
begin
case(next_state)
1'b0:
begin
Out7 <= po[7];
Out6 <= po[6];
Out5 <= po[5];
Out4 <= po[4];
Out3 <= po[3];
Out2 <= po[2];
Out1 <= po[1];
Out0 <= po[0];
next_state <= 1'b1;
end
1'b1:
begin
next_state <= 1'b0;
end
endcase
end
In my case at least, fIguring out how to use UDBs is hard enough without these couple of additional issues.
One last thought (I haven't tried this yet, it's next on my list). Since the the SUB function of the ALU is "SRCA - SRCB", if A1 is SRCB, it is not possible to subtract PI from it (and store it back in A1, for instance). However, if PI is stored as an 8-bit 2's complement negative number and is added to the A1 register instead of subtracted, then the result will be that the PI value is effectively subtracted from the A1 value. I need to figure out the flags, but this seems like it should work fine. Again, I haven't tried it, but maybe setting the parameter as an int8 instead of a uint8 will allow negative numbers and will encode it properly.
Edit 2020/09/10: I did try what I suggested with the 2's complement arithmetic and it worked like a charm. For instance, to subtract 5 by using the ADD function of the ALU, I set PI to -5 in 2's complement (".pi(8'b11111011)") in the datapath setup, and tried ADDing it with a few values like 10, 5, and 3, and I got the correct answers (which was expected). I wanted to know what the flags were set to so I could figure out the best way to do 16-bit arithmetic on a single 8-bit datapath, so I used A1 as the MSB and A0 as the LSB. What is extra nice, is the state of the carry out bit is 0 if the "addition" of the 2's complement PI to A0 results in a negative number, and 1 if not. I used the registered carry flag input to a DEC command on the MSB register (A1), and it performed the operation A1 <- A1 - 1 + carry (carry is 1 if ADD PI + A0 is a positive number, so the DEC A1 command with the registered carry option gives A1 <- A1 - 1 + 1, so A1 doesn't get decremented; but if PI > A0 and the operation ends up with a negative result, the operation is A1 <- A1 - 1 + 0, which decrements A1). So this can be used for 16-bit arithmetic on the 8-bit ALU with two cycles! I double-checked the SUB command on the ALU, subtracting A0 <- A0 - A1 for instance, and the carry flag (which the spec says is "inverted" for SUB results, but I wasn't sure what that meant exactly), let's you use the DEC A1 command with registered carry again to do proper 16-bit math. Just fyi.
Edit 2020/09/14: Short summary: this technique uses a macrocell! Long summary: I was working on my component that used the above technique and I kept seeing an extra macrocell being used. I had declared 4 registers, but 5 macrocells were being allocated to the design and it was driving me nuts trying to figure out what was causing it. I had assumed I had messed up an if or case statement or something and was causing an implicit latch instantiation, but nothing I did seemed to make any difference (and from what I can tell, Warp doesn't care if you're missing a final else statement, or if you haven't specified all possible cases in a case statement... it doesn't create implicit latches like other synthesizers in those cases it seems). I eventually broke down and started rummaging in the PSoC Creator file output and got my answer. It turns out the extra macrocell was used to provide the value to the Parallel Input (which is why I mention it here). In the "codegentemp" there was a file <component_name>_p.vh2 that is the VHDL translation of the Verilog code it looks like. In it, there was a macrocell definition called "__ONE__". The only thing this macrocell does is supply logic 1s to the appropriate bits in the value provided to the Parallel Input. If I set .pi(0) in the datapath instantiation, the macrocell goes away. I had thought that the constant bits would be supplied through a connection with the routing channels (like there was a magic source of 1s and 0s available on it), but it seems that a macrocell in the UDB is needed to supply that logic level. Fair enough, but it's good to know that one of the macrocells will be used if you use the Parallel Input to supply a constant value. I have enough to spare, but was worried it was something more potentially vexing. I don't know where the 0s are coming from (the PI bits that were logic 0 were not connected in the netlist to anything), but I'm not too concerned, it works fine. In the code below, it was set as ".pi(8'b11111011)".
\TEST_COMP:DP_INST\:datapathcell
GENERIC MAP(
[ ... bunch of config deleted ...]
uses_p_out => '0',
clk_inv => '0',
clken_mode => 1)
PORT MAP(
clock => Net_35_digital,
cs_addr_2 => \TEST_COMP:state_2\,
cs_addr_1 => \TEST_COMP:state_1\,
cs_addr_0 => \TEST_COMP:state_0\,
ce0_comb => \TEST_COMP:lsb_equal\,
z0_comb => \TEST_COMP:lsb_zero\,
ce1_comb => \TEST_COMP:msb_equal\,
z1_comb => \TEST_COMP:msb_zero\,
p_in_7 => __ONE__,
p_in_6 => __ONE__,
p_in_5 => __ONE__,
p_in_4 => __ONE__,
p_in_3 => __ONE__,
p_in_1 => __ONE__,
p_in_0 => __ONE__,
busclk => ClockBlock_HFClk);
__ONE__:macrocell
GENERIC MAP(
eqn_main => "1'b0",
regmode => 0,
clken_mode => 1)
PORT MAP(
q => __ONE__);
I am getting closer to being done now that this is resolved as well.
Show LessOK, so I've spent the last week or so trying to get my head around how to implement OTA updating in my code.
I've got a simple LED Blinking program, that currently sets the blink rate based on the value of BLINK_RATE. I can update this code OTA succesfully.
My next step was to attempt to enable Bluetooth when the LED Blinking code was operating, so that I can utilise a custom service to write a new value for the blink rate and have the code react to that. Longer term, I was hoping to use a characteristic within my custom service to actually trigger the Bootloader to start (at the moment I'm using the SW2 on the Pioneer board, but my hardware won't have a button for users to press, so I need to be able to do this via BLE)
I've attempted to follow the key elements of the BLE OTA Fixed Stack Bootloadable code example, but whenever I try and make a call to CyBle_Start(AppCallBack) and, subsequently, CyBle_ProcessEvents() in my Bootloadable code (LED Blinker OTA with Custom BLE) then the bootloadable code doesn't actually run. I can't even get back to the Bootloader code by pressing SW2 - it just seems to lock everything up.
I've tried to work out what the issue is, but its got me stumped. Can anyone help me get this working?
Cheers,
Mike
Show LessHi,
we have two PCBs utilizing a PSOC 4 BLE (CY8C4248LQI-BL553). These a able to communication via a UART interface, RX + TX.
For this purpose we use a SCB component. This is in unconfigured state, because depending on the hardware variant, this can be an I2C interface instead.
I have a scope on the RX and TX lines and I have been able to observe that even though the bytes are present on the data lines, the PSOC does not seem to receive them. Some times 1 or 2 bytes are missing in the receive buffer and I cant explain why this is.
RxSize and TxSize is 193.
In UART mode, the interface is initialized like this:
// Disable Component before re-configuration
InterComm_Stop();
// UART clock setup - clock to SCB component
InterCommClock_Start();
//InterCommClock_SetFractionalDividerRegister( 25, 1 ); // 48 MHz / (26 1/32) ~= 1,8432 MHz -> 115200 baud rate
InterCommClock_SetFractionalDividerRegister( 52, 0 ); // 48 MHz / 52 ~= 923,077kHz
SetInterCommIoToUart();
InterComm_UART_INIT_STRUCT configUart;
memset( &configUart, 0, sizeof(InterComm_UART_INIT_STRUCT) );
configUart.mode = InterComm_UART_MODE_STD;
configUart.direction = InterComm_UART_TX_RX;
configUart.dataBits = 8;
configUart.parity = InterComm_UART_PARITY_NONE;
configUart.stopBits = InterComm_UART_STOP_BITS_1;
s_pucUartRxBuffer = new uint8_t[ RxSize + 1 ]; // The buffer size must equal (rxBufferSize + 1) in bytes
configUart.rxBuffer = ( uint8* ) s_pucUartRxBuffer;
configUart.rxBufferSize = RxSize;
s_pucUartTxBuffer = new uint8_t[ TxSize ];
configUart.txBuffer = ( uint8* ) s_pucUartTxBuffer;
configUart.txBufferSize = TxSize;
configUart.enableMedianFilter = 1; // Test
// 1,8432 MHz / 16 = 115200 baud rate
//configUart.oversample = 16;//InterComm_UART_IRDA_LP_OVS16;
// 923,077kHz / 8 = 115200 baud rate
configUart.oversample = 8;//InterComm_UART_IRDA_LP_OVS16;
configUart.enableInterrupt = 1; // Enable interrupt
configUart.rxInterruptMask = InterComm_INTR_RX_NOT_EMPTY;
configUart.txInterruptMask = 0;
InterComm_SetCustomInterruptHandler( InterComm_ISR );
InterComm_UartInit( &configUart );
InterComm_Start();
s_ucInterface = ( uint8_t ) HAL_INTERCOMM_UART;
s_ucInitialized = 1;
Reception is handled by a timer. each 4 ms we perform the following:
while( InterComm_SpiUartGetRxBufferSize() > 0 )
{
ch = ( uint8_t ) InterComm_SpiUartReadRxData();
.... // handling received bytes ....
}
Show LessHOw do i decode this data into temperature and humidity.
timestamp: "2020-09-20T20:55:08.629Z"
type: "iBeacon"
mac: "00A05006151F"
bleName: ""
ibeaconUuid: "0005000100001000800000805F9B0131"
ibeaconMajor: 4
ibeaconMinor: 36962 //how do i decode this
rssi: -46
ibeaconTxPower: -61
battery: 0
Show LessWe have many devices deployed with CYBLE-012011-00, using a fixed stack BLE component V3.30.After having build new applications for them, some phones cannot perform an upgrade. For example: A Pixel4a seems fine, A Pixel1XL fails.
When starting the upgrade, it pauses for some time, but never advances the % done. Then several popups come up very fast, but only the last is visible. : CYRET_ERR_CMD. I think I have seen something about a checksum failure, but it's so fast I can't be sure. Considering that some phones work I can only conclude the files are OK and that this is a CYSmart issue, but it could also be the device bootloader I suppose.
Cysmart log on phone that fails is attached, but I don't see an errors in it. The Cysmart version is current from the Playstore.
This is holding up release of application code because we are unsure if this is a more widespread issue that needs correcting.
Are there know issues that could cause this?
Are there known workarounds?
What would you advise?
Show Less