PSoC™ 4 Forum Discussions
text.format{('custom.tabs.no.results')}
Hello,
I am trying to get an SMBus communication working, but having a strange issue. (I am aware of i2C vs SMBus differences and I use a safe speed of 50 kbps). I am trying to implement a Read Word command (here is a nice application note describing all the details: https://www.nxp.com/docs/en/application-note/AN4471.pdf ), meaning in I2C language: Send START for the device address and WRITE. Send the command (register address). Send REPEATED START and read 3 bytes (word has two bytes and this is followed by a Packet Error Check, PEC).
1) I connected an MLX90614 sensor to an I2C Master (fixed function) component of a PSoC 5LP, CY8C5868AXI-LP035.
The following code does exactly as described above, works good. (I stripped all the code comments and variables declarations to get to the core of the process I am using. All variables are correctly defined uint8_t variables and for the record, read_bytes_count = 3)
I2C_MasterClearReadBuf();
I2C_MasterSendStart(i2c_device_address, I2C_WRITE);
I2C_MasterWriteByte(i2c_register_address);
I2C_MasterReadBuf(i2c_device_address, read_buffer, read_bytes_count, (I2C_MODE_REPEAT_START | I2C_MODE_COMPLETE_XFER));
while (0u == (I2C_MasterStatus() & I2C_MSTAT_RD_CMPLT));
2) I tried to port this code to a PSoC 4 device, specifically CY8C4245AXI-483 . A different component is available here, I2C (SCB mode), set as I2C Master (again, 50 kbps).
The only difference is, that this API introduces timeout for all I2C commands, which I tried to set to 5 ms / 10 ms / 35 ms, without any luck.
(My component name is I2C, so the API is named I2C_I2C.... , sorry for the confusion.)
I2C_I2CMasterClearReadBuf();
I2C_I2CMasterSendStart(i2c_device_address, I2C_WRITE, I2C_COMMAND_TIMEOUT_MS);
I2C_I2CMasterWriteByte(i2c_register_address, I2C_COMMAND_TIMEOUT_MS);
I2C_I2CMasterReadBuf(i2c_device_address, read_buffer, read_bytes_count, (I2C_I2C_MODE_REPEAT_START | I2C_I2C_MODE_COMPLETE_XFER));
while (0u == (I2C_I2CMasterStatus() & I2C_I2C_MSTAT_RD_CMPLT));
The same code gets stuck at
while (0u == (I2C_MasterStatus() & I2C_MSTAT_RD_CMPLT));
which leads me to an I2C_MASTER.c generated file:
uint32 I2C_I2CMasterStatus(void)
{
uint32 status;
I2C_DisableInt(); /* Lock from interruption */
status = (uint32) I2C_mstrStatus;
if (I2C_CHECK_I2C_MASTER_ACTIVE)
{
/* Add status of master pending transaction: MSTAT_XFER_INP */
status |= (uint32) I2C_I2C_MSTAT_XFER_INP;
}
I2C_EnableInt(); /* Release lock */
return(status);
}
The code infinitely goes into this branch:
status |= (uint32) I2C_I2C_MSTAT_XFER_INP;
Which is very strange, as there is a timeout set both when calling the I2C functions, plus there is a SMBus timeout embedded in the connected sensor.
I connected the bus to a logic analyzer and I got the following: Send START for the device address and WRITE. (ACK) Send the command (register address). (ACK).
That's it, no buffer read function happens, not even repeated start.
Any idea what to do next?
Thank you for any advice.
David
Show LessCusotmer is considering to use CSD v4.0 on PSoC4000S and to set multi tuning parameter on the CSD by end-customer's spec.
We think to use SetParam and GetParam API on page61 of CSD component datasheet.
http://www.cypress.com/file/369096/download
Let us know how to wirte these API.
What kind of "paramId" do you have?
Could you provide example project or sample C sourse to set SetParam?
Best Regards,
Show LessHi everybody,
for a project, I have to change pins from I2C to GPIO, in order to drive them thorugh FW, because of test procedures in software.
So I set up Pins 4.0 and 4.1 for I2C SCK, and SDA, but, during SW, IF a condition occurs, I have to change 4.0 and 4.1 to GPIOs pins.
So i made this changes...
if (testing)
{
regVal=CY_GET_REG32(CYREG_HSIOM_PORT_SEL4);
regVal&= ~ 0x00000F00u;
// setta il PIN COME GPIO OUTPUT , configurazione del registro
regVal=CY_SET_REG32(CYREG_HSIOM_PORT_SEL4,regVal|(HSIOM_SW_GPIO<<0u));
I2C_scl_SetDriveMode(I2C_scl_DM_STRONG); // output digitale SCL
regVal=CY_GET_REG32(CYREG_HSIOM_PORT_SEL4);
regVal&= ~ 0x00000F00u;
// setta il PIN COME GPIO OUTPUT , configurazione del registro
regVal=CY_SET_REG32(CYREG_HSIOM_PORT_SEL4,regVal|(HSIOM_SW_GPIO<<0u));
I2C_sda_SetDriveMode(I2C_sda_DM_STRONG); // output digitale SDA
}
Then I try to drive these pins by software but is not possible. Have you any ideas or I am not doing something?
Thanks,
David.
Show LessHi! I'm working on a project of an IAS that requires Bonding first. But my peer device is another BLE chip (example, I'm using dongle for this). Also, there will be an automatic connection between the two device through CyBle_GapcConnectDevice(); Moreover, I have fixed a passkey using CyBle_GapFixAuthPassKey(1, USER_PASSKEY);.
I have integrated Bonding on the IAS. I require a code that will write a passkey to the IAS. What events do I need and functions? Thanks!
Show LessHello everybody,
I am trying to implement the following scenario: using a PSoC 4 BLE peripheral I updated the privacy example and I am trying to use it in my project. I start the peripheral using a public address; then I connect with an android smartphone to the device, pair it using a fixed passkey, bond the device and afterwards the phone disconnects. After the disconnecting event, the address of my peripheral becomes private random resolvable which is what I want, it even changes ones at a couple of minutes again if there is no connection or every time a connection/disconnection event arrived. Everything is good, but my problem is the following, after I disconnect with the smartphone from the peripheral and the address become private I am not able to reconnect with my smartphone again. Does anyone know if android itself can resolve an address or if the application should scan every time for a device and try to resolve itself the address? I would like to reconnect to a bonded device without scanning, but I do not know if this is possible.
If anyone experienced this, a hint is more than welcomed.
Thank you,
Marian
Update info: The security of my device is set to Mode 1, authenticated pairing with encryption, Strict pairing, Display as IO capability(even if this is not entirely correct, the device has no i/o capabilities but I want to use a fixed passkey for this). I observe that the bonding initiated by the smartphone and the exchange of keys is ok. After disconnect event and the address become private I can scan all devices, find the one I need with the orivate address and can connect to it without any bonding. The problem is now the following: after connection and accessing a service(ex. battery level) I am no longer able to do anything. If I try a read than the pairing winodw will pop up again and no matter what I enter the device disconnects.
Update info 2:
Here is a new Update and the project attached. I eliminate all the code except my two state machines that handle this bonding and privacy tasks. Please note in BLEHandler.c that some code is commented since it makes no sense in this test project, especially the fact that remove bonding is done by pressing a button and in the project it is done at reset.
The battery level as it is in SIG has encryption and authenticated on Read. Therefore indeed that may trigger the pairing window again. I am not an expert in how Android or iOS will treat this but if I remove the encryption an authentication than everything is fine. But I do not want to modify this, and I still want some privacy on other custom characteristics, even if after a bonding only that phone can resolve the address.
Other Info: with the cypress dongle and cysmart on PC, when reconnect to the private address, it will pop up the pairing but after ok it says paring completed without the entering pin.
One of my other questions will be: Is there something wrong in how I handle this process in the peripheral? Is there a problem with the application on android and there I should invest some time?
It would be great if someone can point me in a more correct direction. Thank you!
Message was edited by: Marian-Emanuel Ionascu
Show LessHello,
I try to generate Client and Central application by PSoC 4 BLE. To save memory usage, I would like to structure BLE profile by client only.
How can I create the structure without Server by Creator v4.1?
Best regards,
Show LessI have the CY8CKIT-041-41XX, which uses a PSoC 4100S which should support CapSense gestures. This kit includes a trackpad. I have tried enabling the gestures for the trackpad, but when I run the Tuner, no gestures are ever detected. Also, it seems that the scan rate of the trackpad is too slow to reliably detect quick gestures. Is it possible to use gestures with this kit? Is this as fast as CapSense can scan a trackpad?
Show LessI'm a starter at PSOC and Bluetooth, please excuse me for maybe trivial question. I was working on ble workshop and i succesfully run lab1-2-3. But there is not any instance about authentication. I have set my ble component as gap peripheral and changed the security level to "authenticated pairing with encryption" but i didn't understand how can i configure the passkey? Is there any simple example about pairing with passkey? I just want to pair with a passkey with my master(gap central device) then let it read 1 byte device id from peripheral device.
Show LessHello. Where can I read how to get the status of 1 button when using CapSense in PSoC4. In all examples only sliders and position finding.
I want to write a simple type code:
button = CapSense_GetButton(num_of_button); // coined command
if (button != 0)
{
// to do something
}
else
{
do something different
}
In CapSenseCSD component datasheet I can not find the right command.
Show LessHey Folks,
I am working on a Quadrocopter Project where I currently just get a Range of about 10-15 meters using a normal proc module and the usb dongle. I also tried it with the CySmart App getting the same result.
What I did so far to extend the range was setting the Tx Power Level to +3dbm (maximum) but this is unfortunately not enough.
Does anybody has experience with the new CY5674 PRoC BLE SMA Module? Could a better Antenna extend my range to 30-40 meters direct air connection?
Thank you guys so much for your help 🙂
Your Bratwurst
Show Less