element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Members
    Members
    • Benefits of Membership
    • Achievement Levels
    • Members Area
    • Personal Blogs
    • Feedback and Support
    • What's New on element14
  • Learn
    Learn
    • Learning Center
    • eBooks
    • STEM Academy
    • Webinars, Training and Events
    • More
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • More
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • More
  • Products
    Products
    • Arduino
    • Dev Tools
    • Manufacturers
    • Raspberry Pi
    • RoadTests & Reviews
    • Avnet Boards Community
    • More
  • Store
    Store
    • Visit Your Store
    • Choose Another Store
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
Cypress Kits
  • Products
  • Dev Tools
  • Cypress Kits
  • More
  • Cancel
Cypress Kits
Forum PSoC 4 Pioneer Kit Community Project#035 – UART, I2C, and SPI Joystick Example
  • Blog
  • Forum
  • Documents
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Cypress Kits requires membership for participation - click to join
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 20 replies
  • Subscribers 19 subscribers
  • Views 1229 views
  • Users 0 members are here
  • 100projects
Related

PSoC 4 Pioneer Kit Community Project#035 – UART, I2C, and SPI Joystick Example

cy.wbz
cy.wbz over 9 years ago

Hello!

 

This Project demonstrates the simultaneous use of UART, SPI and I2C protocols of communication in one single project. SPI is used to communicate the position of the Joystick in the Pmod JSTK Joystick Module. The I2C is used to obtain the current time from the Real Time Clock (RTC). UART is used to print the time obtained via I2C on the Hyperterminal and move its position in accordance with the Joystick.

  • PSoC 4 Pioneer Kit
  • PmodJSTK – 2 Axis joystick
  • Real Time Clock DS1307

 

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:

  • SPI
  • I2C
  • UART
  • CyPins
  • CyClock

 

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.

 

This firmware example is an excellent demonstration of how the PSoC 4 can interface using three different serial interfaces (SPI, I2C, and UART). The example reads in the time data from the RTC using I2C, then pulls the positioning data from the Joystick using the SPI interface, and then completes the example by sending the RTC value to hyperterminal and using the joystick to control where the RTC value is displayed on the screen.

 

While the example almost seems like a game, please step back and consider how this type of system dynamic would be common in an end design. We can imagine pulling in data from two separate inputs and having to relay those values up to a main host or PC. In many case the input data may affect other data and require some type of data manipulation.

 

Hardware Connections:

 

The user will need to populate and solder the 6 pin Pmod header to the Pioneer kit. This header will allow the user to connect the Pmod Joystick module. The SPI interface that reads the values from the joystick will be configured and set in the PSoC 4 project. There is already a physical connection between the Pmod module and the PSoC 4 device. The SPI pins on the PSoC 4 will be: P3[0], P3[1], P3[5], P0[6], and P0[7].

 

Next connect the Pioneer board to the Real Time Clock board. First connect the Vdd and GND lines from the Pioneer kit to the Clock board. Next connect your I2C lines from the Pioneer board to the Clock board. The I2C lines are: P4[0] and P4[1].

 

Also connect the PSoC 4 UART connections to the PSoC 5LP device so the UART positioning can be relayed up to the host.

 

PSoC 4 P3[7] -> P5LP P12[6]

PSoC 4 P0[5] -> P5LP P12[7]

 


 

Test Your Project:

 

After connecting your project please program the example into the PSoC 4 device. Once programmed then launch your Hyperterminal software to view the UART data traffic. Then use the joystick to control the output on the hyperterminal software.

 


 

I hope this example can help you in your design.

 

Best,

Matt

Attachments:
I2C_SPI_UART.cyprj.Archive01.zip
0447.Project Images.zip
  • Reply
  • Cancel
  • Cancel

Top Replies

  • Former Member
    Former Member over 9 years ago in reply to jesusantoniocar +1

    Hello Jesus,

    There are two types of SPI component available for the PSoC 4 in the PSoC Creator

    1) UDB based

    2) SCB based

     

    For providing the external clock to the UDB based SPI, open the Advanced tab in the…

  • jesusantoniocar
    jesusantoniocar over 9 years ago in reply to jesusantoniocar +1

    Hi.

    It is an interesting article to share:

     

    PSoC 4 Chained Clocks

     

    http://www.cypress.com/?rID=81829&source=home_cdc

     

    best regards,

     

    Jesus Antonio

  • icemanfiveoh
    icemanfiveoh over 8 years ago in reply to icemanfiveoh +1

    Hi,

     

     

    I was successfully able to get the terminal to display the DS1307 RTC Time but it is all over the terminal window. I am going to see if i can strip away some code to stop that from happening. Also,…

Parents
  • icemanfiveoh
    icemanfiveoh over 8 years ago

    Hi,

     

    I got a PSOC 4 Pioneer last week and I'm excited to try and tap into it great potential. My grasp of C++ is ok. I'm trying to accopmlish reading in the time from my RTC-DS1307 module and have it displayed on the Hyperterm. When i try to debug it I get a bunch of errors. The main error is about the clock not being in range or something like that. I actually dont want the joystick in there also. I am trying to port over a project that i already have designed and built.It uses a DS1307 and displays the time on a 2x16 LCD. This project locks my car doors every night(i forget alot) and starts my car on the week days. I have an interface to one of my car keys that closes some dry contacts on the actual key. So, to begin i thought i would try and display the time to the hyperterminal. That is outputting a wierd value 00:00:80. I know this RTC works because i use it in other projects. When i Get home I will post up some screen shots of my errors. Maybe someone can help. I really like the idea of the PSOC but i am having trouble implementing its features.

     

    Jason

    • Cancel
    • Vote Up 0 Vote Down
    • Reply
    • Cancel
  • Former Member
    Former Member over 6 years ago in reply to icemanfiveoh

    HIII icemanfiveoh,

     

     

    You Have solved the RTC issue That is outputting a wierd value 00:00:80, i am getting same value 00:00:80 on hyperterminal, can you please me what is the issue .........i am using same example with psoc 4 controller but getting 00:00:80  on hyperterminla......please uplode code if any one solved this issue

     

    • Cancel
    • Vote Up 0 Vote Down
    • Reply
    • Cancel
Reply
  • Former Member
    Former Member over 6 years ago in reply to icemanfiveoh

    HIII icemanfiveoh,

     

     

    You Have solved the RTC issue That is outputting a wierd value 00:00:80, i am getting same value 00:00:80 on hyperterminal, can you please me what is the issue .........i am using same example with psoc 4 controller but getting 00:00:80  on hyperterminla......please uplode code if any one solved this issue

     

    • Cancel
    • Vote Up 0 Vote Down
    • Reply
    • Cancel
Children
  • jimyu
    jimyu over 5 years ago in reply to Former Member

    Dear Rohit Warule,

     

    Were you able to get the time to display using the above code example.

     

    I am not able to display the correct time......I only get 00:00:00 or 00:00:80 on hyper-terminal.

     

    Please help.

    • Cancel
    • Vote Up 0 Vote Down
    • Reply
    • Cancel
  • koudelad
    koudelad over 5 years ago in reply to jimyu

    Hello,

    the latest post in this a year and a half old, while the original article is 4 years old.

     

    I would suggest the following steps:

    1) Upgrade the project to the newest components (newer versions of PSoC Creator and the hardware component libraries were released).

    2) Try to verify whether you really get the clock data from the RTC.

    3) If the PSoC doesn't work as expected, try to debug it to the part where you succesfully read the RTC registers.

    4) In case of troubles, zip the whole project and create a new question / discussion here, add as much details as possible (schematics, RTC register values...).

     

    David

    • Cancel
    • Vote Up 0 Vote Down
    • Reply
    • Cancel
  • jimyu
    jimyu over 5 years ago in reply to koudelad

    Dear David,

     

    I spoke with the Cypress guys and they are working on this with me.....any help from the people here would be great.

    • Cancel
    • Vote Up 0 Vote Down
    • Reply
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2022 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • Facebook
  • Twitter
  • linkedin
  • YouTube