<?xml-stylesheet type="text/xsl" href="https://community.element14.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>ATCDC: Digimorf, Day 26, The project SEGA SG-1000 Emulator on PSoC62S4 Pioneer kit - part 6</title><link>/challenges-projects/design-challenges/at-the-core-design-challenge/b/blog/posts/atcdc-digimorf-day-26-the-project-sega-sg-1000-emulator-on-psoc62s4-pioneer-kit</link><description>I have been stuck in a problem, I think, in the macros and definitions generated by the project creator wizard. I am not 100% sure, but I have a feeling it&amp;#39;s a bug. Let&amp;#39;s try to explain what happened and what workaround I adopted.
You all have seen t</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: ATCDC: Digimorf, Day 26, The project SEGA SG-1000 Emulator on PSoC62S4 Pioneer kit - part 6</title><link>https://community.element14.com/challenges-projects/design-challenges/at-the-core-design-challenge/b/blog/posts/atcdc-digimorf-day-26-the-project-sega-sg-1000-emulator-on-psoc62s4-pioneer-kit</link><pubDate>Mon, 27 Mar 2023 19:23:04 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:9c871ea8-11f3-43d1-ad64-42b74c612c9b</guid><dc:creator>ClarkJarvis-Infineon</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;Digimorf, I believe the initial issue you are dealing with is that the IDE&amp;#39;s Context Assist is not picking up the compiler defines / macros correctly.&amp;nbsp; This happens quite often with ModusToolbox, as it is using a Make based built system and is separate from the IDE (I&amp;#39;m assuming you are using the Eclipse-based IDE).&lt;/p&gt;
&lt;p&gt;The&amp;nbsp;&lt;span&gt;&lt;strong&gt;CY_CPU_CORTEX_M0P&amp;nbsp;&lt;/strong&gt;macro gets set by including the corresponding cmsis core_cm0.h header file.&amp;nbsp; The Makefile is responsible&amp;nbsp;for including this specific file, but unfortunately&amp;nbsp;that means the IDE is cannot resolve which header file (cm0, cm4, cm7, etc...) is included for context assist features.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;For the CM0 project, the&amp;nbsp;&lt;strong&gt;CY_CPU_CORTEX_M0P&lt;/strong&gt; and&amp;nbsp;&lt;strong&gt;CY_IP_M4CPUSS&amp;nbsp;&lt;/strong&gt;are defined and even though the code in the IDE appears to be compiled out with the &lt;strong&gt;#ifdef&lt;/strong&gt;, it is in fact really there...&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Refer to the code snippet below where I setup a Timer interrupt and mux the peripheral interrupt source to one of the&amp;nbsp;CM0+ IRQ sources.&lt;/p&gt;
&lt;p&gt;[embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:d729196b-01ce-42cb-bac9-55b35a68ace2:type=c_cpp&amp;text=%2F%2A%20Initialize%20and%20Enable%20Timer%20interrupt%20with%20the%20NVIC%20%2A%2F%0Acy_stc_sysint_t%20irqCfg_Timer%20%3D%20%7B%0A%20%20%20%20.intrSrc%20%3D%20NvicMux2_IRQn%2C%0A%20%20%20%20.cm0pSrc%20%3D%20MyTimer_IRQ%2C%0A%20%20%20%20.intrPriority%20%3D%203%0A%7D%3B%0ACy_SysInt_Init%28%26irqCfg_Timer%2C%20MyTimerISR%29%3B%0ANVIC_ClearPendingIRQ%28irqCfg_Timer.intrSrc%29%3B%0ANVIC_EnableIRQ%28irqCfg_Timer.intrSrc%29%3B]&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;In the code snippet above, I have used the Device Configurator to setup a TCPWM as a Timer, and provided a name of &amp;quot;MyTimer&amp;quot;&lt;/p&gt;
&lt;p&gt;The generated code then creates several additional macros that I&amp;#39;m using in my application.&amp;nbsp; For this code snippet above, I&amp;#39;m using &lt;strong&gt;MyTimer_IRQ&lt;/strong&gt; that the Device Configurator has mapped to&amp;nbsp;&lt;strong&gt;tcpwm_1_interrupts_4_IRQn&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;By specifying the additional .cm0pSrc variable and the .intrSrc variable, the device will map the peripheral interrupt source for the TWPWM Group 1 Instance 4 to the CM0+ NVIC IRQ 2&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Make sure the subsequent NVIC_xxxx commands are then using the NvicMux value (and not the peripheral source).&amp;nbsp; I&amp;#39;ve run into that issue in my own projects.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;For additional details here is a good Application Note on PSoC 5 MCU interrupts (&lt;a href="https://www.infineon.com/dgdl/Infineon-AN217666_PSoC_6_MCU_Interrupts-ApplicationNotes-v07_00-EN.pdf?fileId=8ac78c8c7cdc391c017d0d31e0dc6597"&gt;link&lt;/a&gt;)&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=25504&amp;AppID=392&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: ATCDC: Digimorf, Day 26, The project SEGA SG-1000 Emulator on PSoC62S4 Pioneer kit - part 6</title><link>https://community.element14.com/challenges-projects/design-challenges/at-the-core-design-challenge/b/blog/posts/atcdc-digimorf-day-26-the-project-sega-sg-1000-emulator-on-psoc62s4-pioneer-kit</link><pubDate>Mon, 27 Mar 2023 13:58:53 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:9c871ea8-11f3-43d1-ad64-42b74c612c9b</guid><dc:creator>e14phil</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;Hey [mention:d332699ebc20475a9cae2d7a3e2c034c:e9ed411860ed4f2ba0265705b8793d05]&amp;nbsp;I am going to send this over to our technical contacts at Infineon who have kindly offered to help. Hope that is ok with you! [emoticon:c4563cd7d5574777a71c318021cbbcc8]&amp;nbsp;&lt;br /&gt;You posts have been fantastic&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=25504&amp;AppID=392&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item></channel></rss>