2 Replies Latest reply on Sep 10, 2020 5:08 AM by LePo_1062026

    How to configure I/O during runtime


      I am using PSOC5. I have to configure I/O during runtime as plain I/O or SPI interface depending on a message send to PSOC by USB.

      How can I reconfigure I/O during runtime ?

      I have to configure some I/O s as SPI (in one case) or as in- or output in the other case.

        • 1. Re: How to configure I/O during runtime



          Yes.  It is possible.


          See my previous post to you about the IO drive mode configuring.  How to configure direction of I/O during runtime


          This post will discuss flipping between directIO and SPI functions.


          This is best achieved with making a TopDesign schematic at design-time.


          I don't know your full design intent so here is an example to start you off:


          This is a modification of the circuit I listed in your other posting about drive mode for IOs.


          If this is your design intent, then you can set the IO drive mode and SPI MOSI and MISO routing with ONE bit in CR_OE_ctrl.


          If this is not your intent, can you be more specific of the relationship of the SPI comm and the drive mode switchable IO?



          • 2. Re: How to configure I/O during runtime



            Before I forget, I have a Caveat section for my previous post.


            If you are in the middle of a SPI communication session and you switch IO assignments, you WILL corrupt the outgoing and incoming SPI data.  To avoid this, make sure the the SPI comm status is SPI_TX_DONE before you switch IO.