- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
I have a CY8CKIT-062S4 kit and I'm learning to use the PDL libraries on the CM0+ CPU.
I followed the examples and wrote this code:
int main(void)
{
/* Enable global interrupts */
__enable_irq();
/* Enable CM4. CY_CORTEX_M4_APPL_ADDR must be updated if CM4 memory layout is changed. */
Cy_SysEnableCM4(CY_CORTEX_M4_APPL_ADDR);
if(CY_GPIO_SUCCESS != Cy_GPIO_Pin_Init(P2_7_PORT, P2_7_NUM, &pinConfig))
{
/* Insert error handling */
}
uint32_t pinState = 1UL;
for (;;)
{
// Cy_SysPm_DeepSleep(CY_SYSPM_WAIT_FOR_INTERRUPT);
pinState = 1UL;
Cy_GPIO_Write(P2_7_PORT, P2_7_NUM, pinState);
Cy_SysLib_Delay(1000); // 1000ms
pinState = 0UL;
Cy_GPIO_Write(P2_7_PORT, P2_7_NUM, pinState);
Cy_SysLib_Delay(1000); // 1000ms
}
}
The problem is that the led blinks very fast.
Maybe I have to fix the clock.
Any suggestions?
Update
If I run the same code on the CM4 CPU the LED flashes at the right speed.
Thank you
Solved! Go to Solution.
- Labels:
-
ispn:39622:1:0
-
l1:314:1:0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can refer to the Makefile from ipc-sema example. Need to include the CUSTOM_DESIGN_MODUS (for a custom BSP) or BSP_DESIGN_MODUS (for the default BSP) in the COMPONENTS list. The dual-cpu uses the default BSP, so you shall add:
COMPONENTS=BSP_DESIGN_MODUS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Currently, all our code examples initialize the system clocks in the CM4. These is mainly done in the init_cycfg_all() function, which is generated by the BSP code.
If you are not using CM4 to do any initialization, you can call the init_cycfg_all() in the CM0+.
If you are still using CM4 to do the initialization, you need to sync the CM0+ with the CM4 to make sure the clocks are initialized first, then call the function SystemCoreClockUpdate(). This will update some variables internally, so the delay functions work as expected.
You can refer to this code example:
https://github.com/Infineon/mtb-example-psoc6-dual-cpu-ipc-sema
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi RodolfoGL,
I inserted in the main the function init_cycfg_all(); and I included the cycfg.h library but it gives me this compilation error:
fatal error: cycfg.h: No such file or directory
44 | #include "cycfg.h"
---
I tried the mtb-example-psoc6-dual-cpu-ipc-sema example and it works but if I do the same thing with a new Dual_CPU_empty project it doesn't work, I think because the CM4 project is still empty.
What should I set in the CM4 project?
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can refer to the Makefile from ipc-sema example. Need to include the CUSTOM_DESIGN_MODUS (for a custom BSP) or BSP_DESIGN_MODUS (for the default BSP) in the COMPONENTS list. The dual-cpu uses the default BSP, so you shall add:
COMPONENTS=BSP_DESIGN_MODUS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I entered in the Makefile:
COMPONENTS = BSP_DESIGN_MODUS
but nothing changes.
If I program first with the ...IPC_Pipes.app_cm4 project and then with the Dual-CPU_Emplty_....cm0p_app project it works.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm a little bit confused. You had an compilation issue. When adding COMPONENTS=BSP_DESIGN_MODUS, did it fix the compilation error?
When programming a project, always program the CM4, because it includes CM0+ as well. If you program only the CM0+, it doesn't include the CM4.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@RodolfoGL wrote:
I'm a little bit confused. You had an compilation issue. When adding COMPONENTS=BSP_DESIGN_MODUS, did it fix the compilation error?
No, the led blinks very fast, nothing changes.
cm0p:
#include "cy_pdl.h"
cy_stc_gpio_pin_config_t pinConfig = {
/*.outVal =*/ 1UL, /* Output = High */
/*.driveMode =*/ CY_GPIO_DM_STRONG_IN_OFF, /* Resistive pull-up, input buffer on */
/*.hsiom =*/ P2_7_GPIO, /* Software controlled pin */
/*.intEdge =*/ CY_GPIO_INTR_RISING, /* Rising edge interrupt */
/*.intMask =*/ 1UL, /* Enable port interrupt for this pin */
/*.vtrip =*/ CY_GPIO_VTRIP_CMOS, /* CMOS voltage trip */
/*.slewRate =*/ CY_GPIO_SLEW_FAST, /* Fast slew rate */
/*.driveSel =*/ CY_GPIO_DRIVE_FULL, /* Full drive strength */
/*.vregEn =*/ 0UL, /* SIO-specific setting - ignored */
/*.ibufMode =*/ 0UL, /* SIO-specific setting - ignored */
/*.vtripSel =*/ 0UL, /* SIO-specific setting - ignored */
/*.vrefSel =*/ 0UL, /* SIO-specific setting - ignored */
/*.vohSel =*/ 0UL /* SIO-specific setting - ignored */
};
int main(void)
{
/* Enable global interrupts */
__enable_irq();
Cy_SysEnableCM4(CY_CORTEX_M4_APPL_ADDR);
// Initialize pin P2.7
if(CY_GPIO_SUCCESS != Cy_GPIO_Pin_Init(P2_7_PORT, P2_7_NUM, &pinConfig))
{
// Insert error handling
}
/* Update clock settings */
SystemCoreClockUpdate();
for (;;)
{
Cy_GPIO_Write(P2_7_PORT, P2_7_NUM, 0x01);
Cy_SysLib_Delay(1000); // 1000ms
Cy_GPIO_Write(P2_7_PORT, P2_7_NUM, 0x00);
Cy_SysLib_Delay(1000); // 1000ms
}
}
Makefile cm0p e cm4:
COMPONENTS=BSP_DESIGN_MODUS
When programming a project, always program the CM4, because it includes CM0+ as well. If you program only the CM0+, it doesn't include the CM4.
Ok
Thank you