PSoC™ 4 Forum Discussions
text.format{('custom.tabs.no.results')}
Hello, I have recently purchased the CY8CKIT-044 PSoC® 4 M-Series Pioneer Kit and having a great time learning how to do simple projects. I am trying to write a simple program to interface with a 74HC595 Shift Register to control 8 LEDS. The HC595 has a Clock input, a Serial Data Input and a Latch. I am trying to use the Shift Register in the PSoc Creater and need some help with the top schematic. I have uploaded my top schematic for review. I want to know how I can create a bursted clock that will be used to clock in the data the the HC595. I have tried to use the Clock component from the SYSTEM group and connect it to a Digital Output pin but it won't compile. If anyone could give me some suggestions of know of an example that uses an Shift Register please let me know.
Thanks,
Joe
Show LessI working to send a simple Int between two BLE devices. I've been able to run the UART example in which one device is setup as a central and the other as peripheral. All works well there. This allows you to type in a serial window and it sends it to the other device.
What I'm trying to do now is a simple Int programmatically between the two devices. I am able to get the data back and forth however it always comes out weird on the device that I'm sending it to.
Here is how I send a piece of data from my peripheral device:
void Send_Event_Code_To_Sensor(int eventCode)
{
CYBLE_API_RESULT_T bleApiResult;
CYBLE_GATTS_HANDLE_VALUE_NTF_T tempHandle5;
tempHandle5.attrHandle = CYBLE_SERVER_UART_SERVER_UART_TX_DATA_CHAR_HANDLE;
tempHandle5.value.val = (uint8*)eventCode;
tempHandle5.value.len = sizeof(eventCode);
do
{
bleApiResult = CyBle_GattsNotification(cyBle_connHandle, &tempHandle5);
CyBle_ProcessEvents();
}
while((CYBLE_ERROR_OK != bleApiResult) && (CYBLE_STATE_CONNECTED == cyBle_state));
}
Here is how I receive it on the central device:
void HandleUartRxTraffic(CYBLE_GATTC_HANDLE_VALUE_NTF_PARAM_T *uartRxDataNotification)
{
if(uartRxDataNotification->handleValPair.attrHandle == txCharHandle)
{
unsigned int paramVal = *uartRxDataNotification->handleValPair.value.val;
}
}
The problem is that when I receive the data it's always something weird.
For instance, if I try to send the number 1 from my peripheral like this:
Send_Event_Code_To_Sensor(1);
It decodes as 64 on my central device. What am I doing wrong here? Is it because I'm sending it as a pointer here:
tempHandle5.value.val = (uint8*)eventCode;
Maybe?
Show LessHello,
I am using cypress CYBL10161-56LQXI. I am using I2C as a slave. I have a problem that after my slave sends the desired data, in the next cycle when master asks the slave if any data is available and if there is no data available, the cypress sends 0xff,0xff....[Buffer length].
I am using this,
strncpy(i2cReadBuffer,"abcd",sizeof("abcd"));
if(0u != (I2C_I2CSlaveStatus() & I2C_I2C_SSTAT_RD_CMPLT))
{
// Clear slave read buffer and status
I2C_I2CSlaveClearReadBuf();
(void) I2C_I2CSlaveClearReadStatus();
}
So here, master would receive abcd first then it receives 0xff,0xff.... It would be great if you could help me out with that.
Thanks.
Show LessI have the PSoC 4 BLE system connected via SPI to a device. That device has a "Who Am I" register at 0x0f that will reply with the value 0x6a if read correctly.
I have used a SCB dialog to create a SPI master, Sub mode: Motorola CLK CPHA=1, CPOL=1
Data Rate: 1Mbps
Rx & Tx data bits 16
Transfer Separation: Separated
Rx & Tx Buffer Size: 8
No Interrupts
I have written the code to just query that register to prove that the SPI bus works. When the register is read correctly a LED connected to Pin 2 is turned on.
What I found was that I had to put a while loop to continuously read the SPI bus to get the correct value. In fact I had to read the bus 9 times first and then on the 10th time the value returned was correct.
Here is the code:
static uint8_t readTheRegByUart(uint8_t theRegAddr) {
uint8_t theRegValue = 0;
uint16_t theReadCmd = 0x8000;
/* read the register */
theReadCmd |= (uint16_t)((uint16_t)theRegAddr << 8);
SPI_SpiUartWriteTxData(theReadCmd);
while(SPI_SpiUartGetRxBufferSize() > 0) {
theRegValue = (uint8_t) (SPI_SpiUartReadRxData() & 0x000000ff);
}
return theRegValue;
}
int main(void) {
uint8_t theValue;
CyGlobalIntEnable; /* Enable global interrupts. */
SPI_Start();
while((theValue = readTheRegByUart(0x0f)) != 0x6a);
Pin_2_Write(0);
for (;;)
{
;
}
}
Am I running into a buffering issue from the Rx FIFO in the SPI implementation? Is using the "Uart" version of the SPI code wrong?
Any insights would be helpful.
Cheers!!
Show LessHello,
I basically want to achieve the following behavior using WDT0 timer but in this moment I face 2 problems.
Use case: Start the WDT0 for about 10 ms (327 for match value); When expire, set a pin on 1 and start the WDT for about 0.28 ms ( 9 in match value). When this expire start ADC conversion, wait for result, start WTD0 for about 0.04ms (1 in match value). When this last time expires set the pin on 0. So basically at each 10 ms I want to create a signal on 1 for about 0.32 ms, like a clock but I want it to run also in deep sleep mode.
First problem is when set a match value < than 5 the CPU resets itself. I do not know why but with 5 in match value it is working but obvious the time is more than the 0.04ms wanted.
Second problem is caused by the interrupt priority as I expect because when run whitout any other component the 0.28 ms time is ~0.24ms and the adc conversion takes 10 uS as expected. On the other hand, when I run my application which includes other components like I2C, BLE, ADC, WDT1, etc; the time is about 0.89 ms (instead of 0.32 ms). I expect that the interrupts from I2C, BLE and others comes in and therefore delays the interrupt for WDT0. I do not need exact times, but close. So it is ok to have lets say 20-30 us delays but not 3 times the expected time.
Therefore my questions are: how to set the WDT0 interrupt to the highest priority to make my pulse? And, of course, why I cannot set a value les than 5 on math register?
Other details: Before start first the WDT0 I set this:
/* Setup WDT Counter 0 to generate interrupt on match */
CySysWdtWriteMode(CY_SYS_WDT_COUNTER0,CY_SYS_WDT_MODE_INT);
/* associate a callback to wdt interrupt */
CySysWdtSetInterruptCallback(CY_SYS_WDT_COUNTER0, WDTCompareMatchCallback);
Then When I start the WDT I do :
/* Write match count */
CySysWdtWriteMatch(CY_SYS_WDT_COUNTER0, XXX); // XXX 327, 9, 1
/* Enable clear of counter on match */
CySysWdtWriteClearOnMatch(CY_SYS_WDT_COUNTER0, 1u);
/* Enable WDT counter 0 */
CySysWdtEnable(CY_SYS_WDT_COUNTER0_MASK);
Every time I reload a match value I do
/* Stop timer */
CySysWdtDisable(CY_SYS_WDT_COUNTER0_MASK);
Thank you!
Show LessHi,
I want to create four HID joysticks and one receiver. Pressed buttons should be transferred at a maximum rate of 60 Hz (only if buttons are pressed). The minimum connection interval at BLE is 7.5 s and only one peripheral could be connected at the same time. It is possible to connect to more than one peripheral with time shifting.
What is the fastest switch rate? Is it possible to switch 4 times within 15 ms?
If not, would daisy chaining be a solution? The receiver would be the central, the first joystick a peripheral and the central for the next joystick. So every device only would have a maximum of two connections, but the lag could be too big (data of joystick 4 would have 4 connection switches).
Another question: How can I check if my HID joystick data is correct? All BLE parameters should be implemented correct if an external receiver would be used.
Thanks for your help.
Show LessI'm currently looking to use CapSense in a proximity sensing application. The hoped for range is 30 cm with a 100 Hz sample rate.
Looking at old Research, if you use a Capaciflector it may be possible to extend the range of the sensor. Basically behind the sensor you place another sensor (with a further ground plane behind that one) and at the same time send the same excitation signal to both sensors.
(It seems that it may be possible using the PSOC Mutual Capacitance mode (CSX) to send the same signals to both sensors synchronously) <- Not true.
Driving the second sensor using the Shield Signal seems like one way to emulate this technology (Synchronous with sensor signal).
On another level, we may build our own sensor, just to confirm how effective this is. Does a proximity sensor shield exist which uses the above multi-layer sensor idea, exist?
Show LessI want to plot potentiometer output values in Matlab. The plotted values are correct, but I don't like how it's plotted. I would like to get a simple ''line'', like on the picture nr.1, but my plot looks like the picture nr 2. So I don't know if that is wrong, since the values are correct but I can't get the ''line''...??? I get the ''line'' when I do the same thing with arduino.There are pictures, Matlab and PSoC code in attachments
Show Less