How to configure I/O during runtime

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
RuGl_1600761
Employee
Employee
25 replies posted 25 sign-ins 10 replies posted

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.

rgl
0 Likes
1 Solution
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

RuGl,

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.

pastedImage_3.png

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?

Len

Len
"Engineering is an Art. The Art of Compromise."

View solution in original post

0 Likes
2 Replies
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

RuGl,

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.

pastedImage_3.png

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?

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes

RuGl,

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.

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes