1 Reply Latest reply on May 28, 2013 7:17 PM by jesusantoniocar

    PSoC 4 Pioneer Kit Community Project#019 – LED Memory! Part Deux. Just Deux it!



      We did not release a project yesterday due to the US holiday. We hope everyone had a great weekend!


      This example expands on the LED Memory example #014. In this update, instead of using the Linker to define the flash storage area for our LED value, we will define a specific flash area to place our LED value. This example pertains more to using PSoC Creator than the PSoC 4 kit, but may be helpful when developing an application using the Pioneer Kit.


      Forum Post Attachments:


      At the bottom of this post we are including the following items:

      • Example Project Zip File
      • Zip File of Images
        • Project Schematic
        • Component Configurations


      Components Used:


      The user can download the example project at the bottom of this post. The project uses the following list of Creator Components:

      • PWM
      • CyClock
      • CyPin


      The components are configured by right clicking on the component in your Top Design schematic view and selecting Configure. Please enable the following selections in the Configuration windows for the listed components above.


      Firmware Description:


      The main.c firmware is included in the example project. Please review the commented sections for more details.

      We have expanded on the example #014 posted earlier in our series. In that project we were writing the LED value to a flash location so it can be remembered when power cycling or reseting the device. Due to the settings in the original project we allowed the linker to define that flash location. In this example we have updated this project to specify an exact flash location.


      In this example we have modified the flash data array define text to:


      #define FLASH_LOCATION __attribute__ ((section(".array_flash_loc")))


      016 - Main.c change.png


      In this line of code we are pointing the flash location to a defined area. We will need to ensure that the linker has this value defined.


      Navigate to the workspace explorer and right click on the project to launch ‘Build Settings’.


      013 - Build Settings Select.png


      Under the Build Settings window select Linker>Command Line from the option tree.


      014 - Build Settings Values.png


      Define a custom flag and add the following command in the text editor:




      015 - Linker command.png


      Click Ok and then navigate back to your project and build the example.


      Hardware Connections:


      There are no hardware connections for this example as the project uses the existing hardware connections on the kit.


      Test Your Project:


      Once the kit is programmed begin pushing down on SW2 push button until a desired color is displayed on the RGB LED. Then Cycle power or push the Reset button on the Kit. You will see that that when you power up the kit or the device returns from being Reset that the LED is displaying the selected color.


      I hope this example can help you out in your design.