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 18 subscribers
  • Views 968 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
    • Up 0 Down
    • Reply
    • Cancel
  • cy.gul
    cy.gul over 8 years ago in reply to icemanfiveoh

    Hi Jason,

    Have you tried using the project attached to the main post here?

    Portion of this example reads in the time data from the DS1307 RTC using I2C. You could extract that portion of the design and use it as a starting point for your auto-cardoor-lock.

    If you've already done that, post your project here and we can try and debug through your issues.

    good luck!

    -Gagan

    • Cancel
    • Up 0 Down
    • Reply
    • Cancel
  • icemanfiveoh
    icemanfiveoh over 8 years ago in reply to cy.gul

    Thanks for the reply.

     

    I will try that tonight and see what happens. If it does not work i'll post up the project.

     

    Jason

    • Cancel
    • Up 0 Down
    • Reply
    • Cancel
  • icemanfiveoh
    icemanfiveoh over 8 years ago in reply to icemanfiveoh

    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, the next step is to see if i can start implementing my previous Arduino project into the PSOC4. I hope so.

     

    Jason

    • Cancel
    • Up +1 Down
    • Reply
    • Cancel
Reply
  • icemanfiveoh
    icemanfiveoh over 8 years ago in reply to icemanfiveoh

    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, the next step is to see if i can start implementing my previous Arduino project into the PSOC4. I hope so.

     

    Jason

    • Cancel
    • Up +1 Down
    • Reply
    • Cancel
Children
No Data
Element14

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