Using both spim and uart?

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

cross mob
Anonymous
Not applicable

Hi. I'm trying to add a second I2C bus to my device so it can run 4 sensors instead of just 2.

I also need to run SPI (for a flash chip to sample data to) and UART to get my data out of there at the end of the run.

So to make this work, I moved my UART from an SCB-based one to the UDB-based UART 2.50.

Unfortunately, I'm now getting

-maximum number of macrocells exceeded (max 32, need 37)

-maximum number of unique p-terms exceeded (max 64, need 77)

-maximum number of status cells exceeded (max 4, needed 6)

Does anyone have any good tips on how to scrounge the extra cells? Or has anyone successfully managed to use both a SPIM and a UDB UART in the same project?

Otherwise, I'll either have to use a hardware I2C multiplexer or I'll have to do a full duplex, bit banged 1 Mbps UART, which may not even be possible (seeing as the TX only SW UART tops out at 115.2k). Both fairly unattractive options.

0 Likes
1 Solution
Anonymous
Not applicable

There is a way (I haven't tried out though). I2C (SCB) blocks can connect to one or more set of pins. In PSoC 4200, when SCB1 is used for I2C, it has following pin options-

SCL - P0[4] or P3[0]

SDA - P0[5] or P3[1]

You need to be careful while switching so as to ensure there is no glitch introduced on the I2C lines. For this, you need to configure following registers-

1. HSIOM_PORT_SEL (for configuring the pin to connect to the SCB block)

2. GPIO_PRT_PC (for configuring the pin drive mode)

Needless to say, this re-configuration is fine only in the case of master.

-Rajiv

View solution in original post

0 Likes
6 Replies
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

Jim,

Consider upgrading to PSoC4M, which has double of hardware blocks.

/odissey1

0 Likes
Anonymous
Not applicable

Jim,

I am assuming, that you are using PSoC 4200 device which has 2 SCBs and 4 UDBs.

1. Is there any specific reason why you don't want to use one I2C block for reading all the sensors?

2. Do you need full UART, that is, both RX and TX? If not, you can select one of these in the component. It will save UDB resources.

-Rajiv

0 Likes
Anonymous
Not applicable

I wanted to use two I2c buses because I want to use 4 devices, and each one has only 2 selectable addresses.

And I’m afraid I do need before transmit and receive.

I suspect I’m going to wind up either using an I2C MUX chip or porting to PSoC 6, unless someone has a better idea...

Thanks!

Sent from my iPhone

0 Likes
Anonymous
Not applicable

There is a way (I haven't tried out though). I2C (SCB) blocks can connect to one or more set of pins. In PSoC 4200, when SCB1 is used for I2C, it has following pin options-

SCL - P0[4] or P3[0]

SDA - P0[5] or P3[1]

You need to be careful while switching so as to ensure there is no glitch introduced on the I2C lines. For this, you need to configure following registers-

1. HSIOM_PORT_SEL (for configuring the pin to connect to the SCB block)

2. GPIO_PRT_PC (for configuring the pin drive mode)

Needless to say, this re-configuration is fine only in the case of master.

-Rajiv

0 Likes
Anonymous
Not applicable

Jim, Did you get a chance to try this out?

-Rajiv

0 Likes
Anonymous
Not applicable

Thanks. In the end, I actually wound up needing 4 I2C buses, and was spinning the board anyway. so I added a hardware I2C MUX. But definitely want to play with this in the future.

Sent from my iPhone

0 Likes