PSoC™ 6 Forum Discussions
Hello.
I am using CY8C6247.
I am implementing DFU and want some advice on whether the following configuration is correct.
- Merge M0/M4 application files.
- Write a value indicating DFU entry in the common ram part of the CM4 core, and perform a soft reset.
- After reset, check common ram value in bootloader and proceed DFU.
If there is no specific value, M0 core is executed immediately.
IAR is used, and the APP ID and linker files are changed.
1. bootloader
define CY_APP_ID=0
linker file : dfu_cm0p_app0.icf
2. M0P application
Define CY_APP_ID=1
Linker file : Linker_m0_dfu.icf
3. M4 application
Define CY_APP_ID=2
Linker file : Linker_m4_dfu.icf
I attach the corresponding link file
Thanks.
Show LessHi,
is it possible to flash a PSoC6, in my case CY8CPROTO-063-BLE, from a ARM device?
I want to connect the CY8CPROTO-063-BLE to a Raspberry Pi and want to flash the CY8CPROTO-063-BLE from this raspberry pi. I saw that ModusToolbox is only available for x86. Also I had a look on pyocd, which already contains some cy* targets, but not for the CY8CPROTO-063-BLE. Is there a solution or a way to flash CY8CPROTO-063-BLE from an ARM device like Raspberry?
Thanks.
Heike
Show LessI am trying to establish a BLE connection on a custom PSoC 6 microcontroller board. I am using a BLE example project that was adapted to my board. The layout includes the two crystal oscillators ECO and WCO for BLE. The programme is executed until the function Cy_BLE_Start(), afterwards the system is frozen. It seems that the BLE startup does not work. The ECO and the WCO clk were activated in the settings (see figure). Can anyone help me?
Show Less
Hello everyone,
I'm trying to generate a sinusoidal signal by following the example codes CE220924 and CE220925. However, when I attempt to build the project, I encounter the following errors:
"Build error: ctdac/cy_ctdac.h: No such file or directory"
"There may be incompatibilities between the Peripheral Driver Library (PDL) driver and the VDAC12_PDL_v1_0 component, please install the latest PDL."
I want to emphasize that I am using the latest version of PSoC 6, and everything is up to date.
Could you please help me understand how to generate the "ctdac/cy_ctdac.h" file or where to download it from?
Thanks in advance for your assistance!
CY8CKIT-062-BLE
Hello, I am trying to communicate I2C. However, it will get stuck when write/read register after wake up from deep sleep. I have been getting stuck here for 1 week and I need your help.
Description
I2C communications will get stuck after wakeup the CPU. In my code, I2C will be initialized after power the board on.
int main(void)
{
__enable_irq(); /* Enable global interrupts. */
/* Place your initialization/startup code here (e.g. MyInst_Start()) */
//Initializes UART
Cy_SCB_UART_Init(UART_HW, &UART_config, &UART_context);
Cy_SCB_UART_Enable(UART_HW);
printf("\r\nInitializing system...\r\n");
//Registers call back
cy_stc_syspm_callback_params_t callbackParams = {
NULL, //base
NULL //context
};
cy_stc_syspm_callback_t deepSleepCb = {
CM4DeepSleepCallBack,
CY_SYSPM_DEEPSLEEP,
CY_SYSPM_SKIP_CHECK_READY | CY_SYSPM_SKIP_CHECK_FAIL,
&callbackParams,
NULL,
NULL
};
Cy_SysPm_RegisterCallback(&deepSleepCb);
printf("System initialization completed!\r\n");
//Initializes tasks
i2cInit();
bleInit();
for(;;)
{
/* Place your application code here. */
while(Cy_SysPm_CpuEnterDeepSleep(CY_SYSPM_WAIT_FOR_INTERRUPT) != CY_SYSPM_SUCCESS);
}
}
void i2cInit()
{
Cy_SCB_I2C_Init(I2C_HW, &I2C_config, &I2C_context);
Cy_SCB_I2C_SetDataRate(I2C_HW, I2C_DATA_RATE_HZ, I2C_CLK_FREQ_HZ);
Cy_SCB_I2C_Enable(I2C_HW);
Cy_SysInt_Init(&I2C_SCB_IRQ_cfg, &I2C_Interrupt);
NVIC_EnableIRQ((IRQn_Type)I2C_SCB_IRQ_cfg.intrSrc);
printf("Completed initializing I2C\r\n");
//Initializes sensors
initAccelSensor();
initMagSensor();
initGyroSensor();
//initLightSensor();
//initBME280Sensor();
//initSi1132Sensor();
Cy_SCB_I2C_Disable(I2C_HW, &UART_context);
}
After initialized i2c communication, the CPU will be entered deep sleep. It will be woken up by the bless interrupt, and read the sensor values.
void i2cTask()
{
Cy_SCB_I2C_Enable(I2C_HW);
//Gets sensor values
//Accelerometer
float accel[3];
getAccelValue(accel);
printf("[Accel]: x = %f, y = %f, z = %f", accel[0], accel[1], accel[2]);
//........
Cy_SCB_I2C_Disable(I2C_HW, &UART_context);
}
void getAccelValue(float *buffer)
{
writeByte(0x18, 0x14, 0xB6); //Soft reset
CyDelay(2);
uint8_t xLsb = readByte(0x18, 0x02);
uint8_t xMsb = readByte(0x18, 0x03);
uint8_t yLsb = readByte(0x18, 0x04);
uint8_t yMsb = readByte(0x18, 0x05);
uint8_t zLsb = readByte(0x18, 0x06);
uint8_t zMsb = readByte(0x18, 0x07);
writeByte(0x18, 0x11, 0b10000000); //Transitions to suspend mode
float xAccel = ((xMsb * 256) + (xLsb & 0xf0)) / 16;
if (xAccel > 2047)
xAccel -= 4096;
xAccel *= 0.0098;
buffer[0] = xAccel;
float yAccel = ((yMsb * 256) + (yLsb & 0xf0)) / 16;
if (yAccel > 2047)
yAccel -= 4096;
yAccel *= 0.0098;
buffer[1] = yAccel;
float zAccel = ((zMsb * 256) + (zLsb & 0xf0)) / 16;
if (zAccel > 2047)
zAccel -= 4096;
zAccel *= 0.0098;
buffer[2] = zAccel;
}
However, i2c communication will always get stuck when trying to read sensor value. The functions which I use for writing/reading registers are the followings:
void writeByte(uint8_t slaveAddress, uint8_t registerAddress, uint8_t byteToWrite)
{
uint8_t writeBuffer[] = {registerAddress, byteToWrite};
while(writeCommandPacket(slaveAddress, writeBuffer, 2) == TRANSFER_FAILED);
}
uint8_t readByte(uint8_t slaveAddress, uint8_t registerAddress)
{
uint8_t writeBuffer[] = {registerAddress};
uint8_t readBuffer[1];
while(true)
{
if(writeCommandPacket(slaveAddress, writeBuffer, 1) == TRANSFER_SUCCESS)
{
if(readStatusPacket(slaveAddress, readBuffer, 1) == TRANSFER_SUCCESS) break;
}
}
return readBuffer[0];
}
static transfer_status readStatusPacket(uint8_t slaveAddress, uint8_t *buffer, uint32_t bufferSize)
{
cy_en_scb_i2c_status_t status;
cy_stc_scb_i2c_master_xfer_config_t masterTransferCfg;
masterTransferCfg.slaveAddress = slaveAddress;
masterTransferCfg.buffer = buffer;
masterTransferCfg.bufferSize = bufferSize;
masterTransferCfg.xferPending = false;
status = Cy_SCB_I2C_MasterRead(I2C_HW, &masterTransferCfg, &I2C_context);
if (status == CY_SCB_I2C_SUCCESS)
{
uint32_t masterStatus;
bool timeoutStatus;
uint32_t timeout = 1000000UL;
do
{
masterStatus = Cy_SCB_I2C_MasterGetStatus(I2C_HW, &I2C_context);
timeoutStatus = waitOneUnit(&timeout);
} while ((0UL != (masterStatus & CY_SCB_I2C_MASTER_BUSY)) && (timeoutStatus == false));
if (timeoutStatus)
{
Cy_SCB_I2C_Disable(I2C_HW, &I2C_context);
Cy_SCB_I2C_Enable(I2C_HW);
}
else
{
return TRANSFER_SUCCESS;
}
}
return TRANSFER_FAILED;
}
static void readSensorValue(command_t command, uint8_t *buffer, uint8_t txPacketSize, uint8_t rxPacketSize)
{
uint8_t writeBuffer[1];
uint8_t slaveAddress = getSlaveAddress(command);
if (getSlaveAddress(command) == getSlaveAddress(ILL_CHIP_ID))
{
if (command == ILL_CHIP_ID)
{
writeBuffer[0] = getCommandAddress(ILL_COMMAND) | getCommandAddress(ILL_TYPE_INC) | getCommandAddress(ILL_CHIP_ID);
}
else
{
writeBuffer[0] = getCommandAddress(ILL_COMMAND) | getCommandAddress(ILL_TYPE_INC) | getCommandAddress(ILL_C0DATA);
}
}
else
{
writeBuffer[0] = getCommandAddress(command);
}
while (true)
{
if (writeCommandPacket(slaveAddress, writeBuffer, txPacketSize) == TRANSFER_SUCCESS)
{
if (readStatusPacket(slaveAddress, buffer, rxPacketSize) == TRANSFER_SUCCESS)
{
break;
}
}
}
}
typedef enum
{
TRANSFER_SUCCESS,
TRANSFER_FAILED,
} transfer_status;
I am sorry that there is no comment, but "writeCommandPacket()", "readStatusPacket()", and "waitOneUnit()" are similar to the functions in the "CE220818_I2C_Master_High_Level01" example project.
It seems that writing/reading registers succeeds but waiting for completing writing/reading registers times out. I checked the reason and I found that the return value of "Cy_SCB_I2C_MasterGetStatus()" always consists "CY_SCB_I2C_MASTER_BUSY", so it means that writing/reading registers never ends. Is that possible!? I also reset i2c components by executing "Cy_SCB_I2C_Disable()" and "Cy_SCB_I2C_Enable()", but It made no difference.
Environments
- accelerometer: BMX055 (Its slave address is "0x18")
At last, thanks for reading this far.
Show LessHello.
I am writing code using CY8C6136.
I am using the EM-EEPROM function, but an error occurs depending on the IAR version.
In version 8.50.9, it was built without any problems, and there was no problem with the operation.
In version 9.40.1 an error occurs without changing any code.
Error[P21835]: attribute "aligned" does not apply
I attach the relevant code.
Which part needs to be modified?
thanks.
Show LessHi ,
Suspecting with libraries upgrading related, previous your library upgrading to 4.3, Modus loading libraries has problem. Just found library upgrading to version 4.6. Modus could not work suddenly.
Finished download of file 'https://itools.infineon.cn/mtb/manifests/mtb-memfault-mw-manifest-fv2.xml'
Finished download of file 'https://itools.infineon.cn/mtb/manifests/sensiml-mw-manifest-fv2.xml'
Finished loading the manifest data (1680 ms)
Loading the device db
error: pathspec 'release-v4.6.0' did not match any file(s) known to git
the application environment had an empty 'MTB_CACHE_DIR', assuming default location
the application environment had an empty 'MTB_OFFLINE_DIR', assuming default location
the application environment had an empty 'MTB_GLOBAL_DIR', assuming default location
ERROR:there was an error retreiving the asset 'https://github.com/Infineon/device-db' commit 'release-v4.6.0' - error: pathspec 'release-v4.6.0' did not match any file(s) known to git
ERROR:Global asset download of device-db loading completed with error.
ERROR:The asyncStepComplete failed for LoadFlag DEVICE_DB.
ERROR:Failed to get the information.
Press "Retry" to try again.
5 error(s), 0 warning(s)
Best regards!
Jenny
Show LessHello together,
I am using the PSoC63 BLE (CYBLE-416045-02). There is a working bootloader on the uC based on the sample code CE22198401. Now I want to protect the debug pins from being read. I have tried to restrict access via the toc2 and rtoc2 registers. However, I can still read the registers via the PSoC programmer. I have set the toc2 register as follows.
#define CY_PS_FLASHBOOT_FLAGS ((CY_PS_FLASHBOOT_VALIDATE_NO << CY_PS_TOC_FLAGS_APP_VERIFY_POS) \
| (CY_PS_FLASHBOOT_WAIT_0MS << CY_PS_TOC_FLAGS_DELAY_POS) \
| (CY_PS_FLASHBOOT_CLK_25MHZ << CY_PS_TOC_FLAGS_CLOCKS_POS)\
| 0x40) //setting bit [6:5] to 0x03
/* TOC2 in SFlash */
CY_SECTION(".cy_toc_part2") __USED static const cy_stc_ps_toc_t cy_toc2 =
{
.objSize = 0UL, /* Object Size (Bytes) excluding CRC */
.magicNum = 0UL, /* TOC2 ID (magic number) */
.userKeyAddr = 0UL, /* User key storage address */
.smifCfgAddr = 0UL, /* SMIF config list pointer */
.appAddr1 = 0UL, /* App1 (MCUBoot) start address */
.appFormat1 = 0UL, /* App1 Format */
.appAddr2 = 0, /* App2 (User App) start address */
.appFormat2 = 0, /* App2 Format */
.shashObj = 0UL, /* Include public key in the SECURE HASH */
.sigKeyAddr = 0UL, /* Address of signature verification key */
.tocFlags = CY_PS_FLASHBOOT_FLAGS, /* Flashboot flags stored in TOC2 */
.crc = 0UL /* CRC populated by cymcuelftool */
};
/* RTOC2 in SFlash, this is a duplicate of TOC2 for redundancy */
CY_SECTION(".cy_rtoc_part2") __USED static const cy_stc_ps_toc_t cy_rtoc2 =
{
.objSize = 0UL, /* Object Size (Bytes) excluding CRC */
.magicNum = 0UL, /* TOC2 ID (magic number) */
.userKeyAddr = 0UL, /* User key storage address */
.smifCfgAddr = 0UL, /* SMIF config list pointer */
.appAddr1 = 0UL, /* App1 (MCUBoot) start address */
.appFormat1 = 0UL, /* App1 Format */
.appAddr2 = 0, /* App2 (User App) start address */
.appFormat2 = 0, /* App2 Format */
.shashObj = 0UL, /* Include public key in the SECURE HASH */
.sigKeyAddr = 0UL, /* Address of signature verification key */
.tocFlags = CY_PS_FLASHBOOT_FLAGS, /* Flashboot flags stored in TOC2 */
.crc = 0UL /* CRC populated by cymcuelftool */
};
What I have also read is that I can protect the PSoC via the efuse, but I am not sure what bits I need to set here to just protect the pins.
Can you tell me the best way to do this and which bits to set where to protect only the debug pins?
Many thanks for your help
R. Walter
Show Less