PSoC™ 6 Forum Discussions
How does the CY8C624AAZI-S2D44 enable programming development in PSoC Creator 4.4?
smartconx_target@Q!w2e3r4t5y6u7i8o9p0||/t5/PSoC-6/CY8C624AAZI-S2D44%E5%A6%82%E4%BD%95%E5%9C%A8PSoC-Creator4-4%E5%AE%9E%E7%8E%B0%E7%BC%96%E7%A8%8B%E5%BC%80%E5%8F%91/td-p/695989
Show LessDear PSOC-community,
i'm just beginning embedded development so bear with me. I'm trying to connect a I2C Ambient light sensor(ALS) (https://cdn-learn.adafruit.com/downloads/pdf/adafruit-veml7700.pdf, https://www.vishay.com/docs/84286/veml7700.pdf) to a PSOC6 (CY8CPROTO-063-BLE) via the I2C Bus.
The code is based on "PSoC 6 101: Lesson 2-1a Basic UART Implementation"(https://www.youtube.com/watch?v=ZJOF2f423nI&t=148s). And i got an UART component running and printf-printing to a terminal(via the KitProg UART). Lovely tutorial! 🙂
I then attempt to use the high level I2C master interface to an I2C-block .(https://infineon.github.io/psoc6pdl/pdl_api_reference_manual/html/group__group__scb__i2c__master__high__level__functions.html)
Main code reads as follows:
#include "project.h"
#include <stdio.h>
#include "cy_scb_i2c.h"
#define ALS_slave_addr 0x10 // I2C address for
uint8 wbuf[1] = {0x04}; // i2c write buffer with read ALS command
cy_stc_scb_i2c_master_xfer_config_t i2c_write = {
.slaveAddress = ALS_slave_addr,
.buffer = wbuf,
.bufferSize = 1,
.xferPending=true // after write do not generate stop condition
};
uint8 rbuf[2] = {0x12, 0x34}; // i2c receive buffer with dummies
cy_stc_scb_i2c_master_xfer_config_t i2c_read = {
.slaveAddress = ALS_slave_addr,
.buffer = rbuf,
.bufferSize = 2,
.xferPending=false
};
int main(void)
{
__enable_irq(); /* Enable global interrupts. */
/* Place your initialization/startup code here (e.g. MyInst_Start()) */
/* UART and printf to UART */
UART_Start();
UART_PutString("\r\nUART of PSOC6 has started!\r\n");
setvbuf(stdin, NULL, _IONBF, 0); // unbuffered stdio(printf)
/* I2C init */
I2C_Enable();
I2C_Start();
printf("I2C_MasterGetStatus: %lX\r\n", I2C_MasterGetStatus());
cy_en_scb_i2c_status_t i2c_status;
for(;;)
{
/* Place your application code here. */
Cy_SysLib_Delay(1000);
UART_PutString("Hello from UART\r\n");
printf("Hello from printf!\r\n");
i2c_status = I2C_MasterWrite(&i2c_write);
printf("I2C status upon write: %lX\r\n", i2c_status);
while(0u == (I2C_MasterGetStatus() & CY_SCB_I2C_MASTER_WR_CMPLT_EVENT)) {
;;
}
printf("I2C write complete.\r\n");
I2C_MasterRead(&i2c_read);
while(0u == (I2C_MasterGetStatus() & CY_SCB_I2C_MASTER_RD_CMPLT_EVENT)) {
;;
}
// look into read buffer to get ambient light
uint16 val = *((uint16*)i2c_read.buffer);
printf("Ambient light = %X\r\n",val);
}
}
Output in terminal is:
"UART of PSOC6 has started!
I2C_MasterGetStatus: 0
Hello from UART
Hello from printf!
I2C status upon write: 0" (then hangs at: CY_SCB_I2C_MASTER_WR_CMPLT_EVENT(?))
I tried to put a scope to the I2C clock line, but cannot see any activity (remains high). I have quadruple checked the wiring (note, the Adafruit breakout board for the sensor comes with I2C pullup resistors!), and believe that i must miss something in the code (?)... Can anyone see if i am using the I2C API Correctly?
Kind regards, Erik
Show Less
Dear team,
I am trying the UART code but I am modifying the code by sending a string again and again that time he is only one time asking to user.
so I want to again and again ask to the user. I also put a while (1) loop but still itis not working. so please any uart example for sending new strings again and again.
Show Less
Hi All,
In my project, I am using RTC with a button cell. where button cell voltage(Vbat) is connected to Vbackup.Where the system is powered RTC works fine but when I reset the system (remove all power except Vbackup)RTC count gets reset.
Currently, I have not considered any power mode and using extern crystel on WCO.
Please suggest a flow to save the RTC count on the power cycle.
Show LessHello everyone,
We have developed a device using the PSOC6 CY8C6347BZI-BLD53 cip and we want to extend the device with 5G communication capabilities. Since the actual PSOC 6 board cannot be altered at the moment, the only solution we have is to connect the new 5G module to the board via UART/SPI/I2C interface (and additional control pins) that are available on an external connector.
We do not have a lot of experience working with 5G modules and thus we are asking for some suggestions of on the shelf modules (even dev boards) that can be integrated with our PSOC6 chip. Maybe some of you have similar experiences and can provide some insight.
The question basically is what 5G modules that can be integrated using a serial connection are suitable for using with PSOC 6 boards.
Thanks in advance!
Marian
Show LessHola comunidad, quiero hacer funcionar mi sensor ultrasonico HC - SR04 en mi CY8CPROTO-062-4343W , pero no encontre ningun proyecto que trabaje en Mouds Toolbox, me podrian ayudar?
Show LessHi
I am exploring how to change the configuration of GPIO between input and output in run time.
I could not figure out the effect of the buffer: What is the difference between CY_GPIO_DM_PULLUP_IN_OFF and CY_GPIO_DM_PULLUP?
Also, if you want to switch the GPIO between input and output within the program, what is the proper hardware connection and setting to sue ?
thanks
Show Less