Hi All,
I tried to implement I2C communication between Cy8C4025AZI-S412( Slave ) and Pic Microcontroller(Master). The speed is 100kbps and used polling method. When button not pressed then it will sent 0xFF. The polling time is 100msec by PIC controller.
The issue is,
1) Sometimes acknowledge not given by Slave.(need to sent data 3 to 4 times or delay of 30ms then it gives ack ).
I used one example code to develop I2C.
My code is below,
#include <project.h>
/* Macro Declaration */
#define BUFFER_SIZE (1u)
#define PACKET_SIZE (BUFFER_SIZE)
/* The I2C Slave read and write buffers */
uint8 i2cReadBuffer [BUFFER_SIZE] = {0};
uint8 i2cWriteBuffer[BUFFER_SIZE]= {0};
uint8_t flag1=0;
uint8_t flag3=0;
void Received_Data_From_Master1();
int main()
{
/* Eneble Global Interrupt */
CyGlobalIntEnable;
CapSense_Start();
CapSense_ScanAllWidgets();
/* Start the I2C Slave And I2C Address Setting*/
I2CS_I2CSlaveInitReadBuf(i2cReadBuffer, BUFFER_SIZE);
I2CS_I2CSlaveInitWriteBuf(i2cWriteBuffer, BUFFER_SIZE);
I2CS_I2CSlaveSetAddress(0x08);
I2CS_Start();
for (;;)
{
CyDelay(2);
/* With Respect to Master i.e Checked Whether the Master Write Complted Or Not */
if (0u != (I2CS_I2CSlaveStatus() & I2CS_I2C_SSTAT_WR_CMPLT))
{
/* Calling Function to Collect The Data From Master */
Received_Data_From_Master1();
/* Enable this above function when we used the data On Switch Function */
/* Clear the slave write buffer and status */
I2CS_I2CSlaveClearWriteBuf();
(void) I2CS_I2CSlaveClearWriteStatus();
}
if(CapSense_NOT_BUSY == CapSense_IsBusy())
{
/* API For Capsense Update Scanning And Process */
CapSense_ProcessAllWidgets(); /* Process all widgets */
CapSense_RunTuner(); /* To sync with Tuner application */
/* Checked whether Left Button Active or Not*/
if((flag3==0)&&(CapSense_IsWidgetActive(CapSense_BUTTON2_WDGT_ID)) )
{
flag3=1; /* Reseting Left Button Flag */
i2cReadBuffer[0] = 0x01;
while (I2CS_I2C_SSTAT_RD_CMPLT!=(I2CS_I2CSlaveStatus()));
/* Clear the slave read buffer and status */
I2CS_I2CSlaveClearReadBuf();
(void) I2CS_I2CSlaveClearReadStatus();
i2cReadBuffer[0] = 0xFF;
}
else if((flag3==1) && (!(CapSense_IsWidgetActive(CapSense_BUTTON2_WDGT_ID))))
{
flag3=0; /* Setting Left Button Flag */
i2cReadBuffer[0] = 0xFF;
}
/* Checking Right Button active or not */
if((flag1==0)&&(CapSense_IsWidgetActive(CapSense_BUTTON0_WDGT_ID)))
{
flag1=1; /* Reseting the flag*/
i2cReadBuffer[0] = 0x06;
while (I2CS_I2C_SSTAT_RD_CMPLT!=(I2CS_I2CSlaveStatus()));
/* Clear the slave read buffer and status */
I2CS_I2CSlaveClearReadBuf();
( void) I2CS_I2CSlaveClearReadStatus();
i2cReadBuffer[0] = 0xFF;
}
else if((flag1==1)&& (!(CapSense_IsWidgetActive(CapSense_BUTTON0_WDGT_ID))))
{
flag1=0;
}
}
}
}
void Received_Data_From_Master1()
{
switch(i2cWriteBuffer[0])
{
/* After Receiving 00 touch will be Ready to Work */
case 0x00:
i2cReadBuffer[0] = 0x19; /*According to New Document Wants to transmit new data acknowledgement */
POWER_LED_Write(0);
break;
}
}
Any Help will be highly appreciated .
Thanks & Regards,
AsDh
Show Less
ello there,
I created a program in Psoc 4 BLE using uC / OS III, however when I add a task for the button and send it to Psoc and put it to work, the other tasks start normally, but do not do their functions normally, that is , they start and remain the same as they started, without doing their job. Could someone please check my program for me. The problem is in the App_Botao_Pedestre_1_Task task.
To access the project, open Psoc Create and then click on "file-> Open-> Project / workspace" and open the folder "Micrium\Examples\Cypress\CY8CKIT-044\OS3\PSoC\OS3.cywrk"
Show LessI like to use this device running an USB - HID profile. According datasheet Pin 13.1 (D-) 13.0(D+) and P13.2 VBUS (5V from USB?). Datasheet of USB tells me that I also have to assign VBUS to P0.0 ..(for 4200L devices). For me this is all not clear how to wire. It would be very great if your datasheet hold a schematics of all possible scenario.. how to connect. Pease assist !!
I like to run it as self powered, Not Bus powered. Please tell me the exact setting in USB configuration, and how to wire... what to connect where and how, Thanks.
Show LessHi, I am using CY8C4248LQI-BL583 and Launcher - Stack - Application configuration.
Currently having an issues providing OTA functionality to iOS app, because, after bonding to application, when it jumps to stack and tries to connect, it complains about "Peer removed pairing information".
It happens that iOS tries to pair, but since the Stack and Application has its own checksum exclude areas, they have its own bonding information, so the pairing with stack fails, because bonding information stayed with application, moreover both of them have the same MAC address, and this is what smartphone does not like.
Question - is there an easy way to share bonding keys between the two?
We can make workaround, to copy one bonding information to another, from Application to Stack project, but maybe there is a way to link them to one place using linker scripts?
Show LessHello to all,
I am new to the BLE and bluetooth, OTA and few weeks ago started with the development kit (There I have 2 CPUs: BLE - CYBLE-222014 and MCU - CY8C4146AZI-S433). The firmware upgrade is done over the OTA and code is already available. The application to perform upgrade is on the mobile phone. But the procedure to update the FW seems very complicated for the normal user. As I see for the BLE part we have 3 projects: launcher, stack using the BLE with profile "BLE bootloader" and application with BLE and profile "BLE application".
When application is being used mobile phone and the kit are connected using the BLE profile "BLE application". And over this profile I can also update the MCU fw (both are connected using the I2C and on the MCU we have I2C bootloader) Which is ok and simple to the user. In the MCU we have 2 projects bootloader and application.
When we try to update the BLE fw over the OTA, the user has to disconnect from the kit. Then start the kit in such a way, that BLE is started in the bootloader mode. User then has to connect to the kit using BLE profile "BLE bootloader". After the update is done, user has to unpair with the kit "BLE bootloader" and again pair to the kit "BLE application".
I looked at the example and found similar case in this example: CE220960 - PSoC 6 MCU BLE Upgradable Stack Bootloader
The question is, why can't I use one BLE profile for all the actions? Must say that this approach is very complex for normal users. And also why are the bonding information deleted?
Also, could we not just use the mobile phone to put the kit into the bootloader mode? From the documentation 001-97060_AN97060_-_PSoC_4_BLE_and_PRoC_BLE_-_Over-The-Air_OTA_Device_Firmware_Upgrade_DFU_Guide.pdf
the bonding information should remain unchanged.
I am still searching the forum to find the answer to this question or maybe an example how someone has done this using one BLE profile only.
I again apologize for any beginner questions as lot of stuff here is new to me and I hope someone can clarify this questions.
Thank you very much for the answers, Frenk
Show LessHello,
I have a PSOC 4 MCU with BLE 4.1
I would like to understand if there is a way to verify a write response was actually sent to a write request?
Today, I use this API function provided by cypress:
CyBle_GattsWriteRsp(cyBle_connHandle)
The function is said to return the following options:
* \return
* CYBLE_API_RESULT_T : Return value indicates if the function succeeded or
* failed. Following are the possible error codes.
*
* Errors codes | Description
* ------------ | -----------
* CYBLE_ERROR_OK | On successful operation
* CYBLE_ERROR_INVALID_PARAMETER | 'connHandle' value does not represent any existing entry in the Stack
* CYBLE_ERROR_INVALID_OPERATION | This operation is not permitted
* CYBLE_ERROR_MEMORY_ALLOCATION_FAILED | Memory allocation failed
So even if I get CYBLE_ERROR_OK returned, it doesn't necessarily mean that the response was sent yet. I understand that it just means that the request to send a response has been received successfully by the stack and it will now take care of it asynchronously. This is a problem for us because we need to reset the MCU immediately after receiving a specific write request. But we need to send a response before the reset, otherwise, it will cause a problem in the device that had sent the write request.
So we need to be able to know that the response has actually been sent. How can we know this?
Thanks,
Eyal
Show LessHello
There is the following description in the debug select column of PSoC Creator.
”Controls whether or not to reserve pins for debugging. If any JTAG or SWD option is selected, the debugging features of the chip will be externally accessible. If GPIO is selected the pins are available for general purpose use. When set to GPIO the device can For more information see the device datasheet or Technical Reference Manual (TRM). Still be acquired with SWD / JTAG, and reprogrammed, but not for debugging.”
Where can I specifically refer to TRM for more information on this?
Best Regards
Hayato
Show Less
We use the Cypress CY8C4248LQI-BL553 CPU and an Ethernet Controller (ENC28J60).
We need to implement a TCP Stack for this system. Do you have some know-how concerning such a case ?
and can we get some support ?
Hello there,
I implemented code in psoc 4 with uC / OS, where there are tasks and interruptions, but I had a problem with the interruption. The interrupt I created is a button. The interrupt works, but when the interruption comes to an end, the tasks return to where they left off and I would like them to return from the beginning, is there any function of uC / OS III that does this?
To access the project, open Psoc Create and then click on "file-> Open-> Project / workspace" and open the folder "Micrium\Examples\Cypress\CY8CKIT-044\OS3\PSoC\OS3.cywrk"
Show LessHello,
I am using CYBLE-212020-01 modules which sends and receives some values over BLE from App.
I use Over-the -Air (OTA) firmware update.
The workspace encloses three projects functions are as follows:
1. Launcher project
The purpose of the project is to:
- Start either the Stack or Application project image
- Copy the Stack project image from a temporary location to the persistent location (just after the Launcher project image).
2. Stack project (contains the BLE Stack)
The purpose of the project is to:
- Host the BLE Stack
- Upgrade the Application project image
- Upgrade the Stack project image itself
- Receive updates for the Stack project image itself or for the Application project image
3. Custom Apllication Project
The Stack project is the bootloader.
I have a build that creates a stack.cyacd and app.cyacd.
I would like to combine the two to take advantage of the "Application and stack (combined) update" option of CySmart App.
The reason for this is that my application is using Upgradeable Stack project and so application image must match the correct stack or else device will not boot / operate correctly.
With two separate files, it is easy for client to update incorrectly and "brick" the device.
How can I either create the "combined update" file during build or combine the separate stack and app .cyacd files?
I read the following guide
CyMCUElfTool 1.0 User Guide but It is for PSoC6.
We in our project use CYBLE-212020-01 (PSoC 4.2).
Then I read the following link
But in the previous link Cypress explain how to merge two elf in one file .hex.
How I can convert .hex file combined in a .cyacd2 file for CYBLE-212020-01 (PSoC 4.2)?
Thanks in advance for any replies.
Lucia
Show LessExpert II
Esteemed Contributor
Employee
Honored Contributor II
Employee
Employee
Honored Contributor II
Employee