Announcements
Community Announcement : Welcome to the NEW Cypress Developer Community.
cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 4

PaHe_1325231
New Contributor

Hi all

   

 

   

I think I know why i am getting the above message so what I would like to know is it possible to fit 1 UART, 2 SPI and 4 I2C connections into my CYBLE-014008-00 design? Can I just utilise GPIO pins and 'make' connections to save on resources?

   

 

   

Thank you in advance

0 Likes
1 Solution
Bob_Marlowe
Expert II

The pin connections for the SCB based UART are fixed/restricted and cannot be changed.

   

The CY8C14008 module has got 2 SCBs and 4 UDBs (3 of those are needed to build a UART), so with the chip selected you are hopelessly out of resources.

   

 

   

Bob

View solution in original post

0 Likes
17 Replies
Anonymous
Not applicable

You have overloaded you resources. You need to put your design in a bigger chip like Psoc 5LP.

0 Likes
rola_264706
Honored Contributor II

Here is your program fixed. I changed the UART component.  You may need to move some of the connections.

0 Likes
PaHe_1325231
New Contributor

Thanks very much, is it possible to just use, for example UART, 2 pins and do the connection in software without using any SCB's?

   

This is V1 prototype so PSoC 5 will be implemented but BLE was needed for this design

   

 

   

Thanks again

   

 

   

Regards

0 Likes
PaHe_1325231
New Contributor

Also sorry is it possible to use 1 SPI or I2C block for multiple connected components? Just toggle the appropriate CS?

   

Regards

0 Likes
Bob_Marlowe
Expert II

The pin connections for the SCB based UART are fixed/restricted and cannot be changed.

   

The CY8C14008 module has got 2 SCBs and 4 UDBs (3 of those are needed to build a UART), so with the chip selected you are hopelessly out of resources.

   

 

   

Bob

View solution in original post

0 Likes
PaHe_1325231
New Contributor

Thanks very much lads for your help, yes primary reason for selecting this chip was the ble, how silly of me. Just last question could I have theoretically an I2C component and a SPI component and then use various GPIO pins for chip select. Physically my 4 I2C devices are connected to the same I2C PSoC component/pins and same for my 2 SPI components, connected to the one PSoC SPI component/pins, Data is only read from the 'Enabled' component?

   

Thanks again 

0 Likes
Bob_Marlowe
Expert II

Well, for 1 I2C master and one SPI master addressing up to 4 SPI slaves are resources in your PSoC CYBLE-014008-00.

   

 

   

Bob

PaHe_1325231
New Contributor

Sorry Bob just to be clear, I have enough resources in my cyble to implement an i2c master and control a couple of slaves and an spi master and control my slave devices? 

   

 

   

Thanks for the valuable help

   

 

   

regards

   

 

   

paddy

0 Likes
Bob_Marlowe
Expert II

Yes, you are right: 1 i2c master controlling several (~100)  slaves and additionally 1 SPI Maser controlling several (depending on ss-line IO pins available) SPI slaves.

   

 

   

Bob

PaHe_1325231
New Contributor

Thanks so much Bob , I was getting desperate and was going to add an i2c and/or spi multiplexer. Phew. Thanks again

0 Likes
PaHe_1325231
New Contributor

Bob sorry one last question, using an I2C master and connecting all the sda lines together and the sclk lines together, how does the PSoC address an individual slave component?

0 Likes
Bob_Marlowe
Expert II

Using the slave address in the APIs as MasterSendStart()

   

Byte I2C interface is quite simple: After setting up the component and starting it you use

   

    I2C_MasterSendStart(DeviceAddress,I2C_WRITE_XFER_MODE);    // Initialize a transaction for writing
    I2C_MasterWriteByte(Register);                // Indicate which register you want to write to
    I2C_MasterWriteByte(Value);                // Write to register
    I2C_MasterSendStop();                    // End of transaction

   

When you want to read from a device you use (example for reading two bytes

   

    I2C_MasterSendStart(DeviceAddress,I2C_WRITE_XFER_MODE);    // Initialize a transaction for writing
    I2C_MasterWrite(Register);                // Indicate which register you want to write to
    I2C_MasterSendRestart(DeviceAddress,I2C_READ_XFER_MODE);
    I2C_MasterReadByte(I2C_ACK_DATA);            // Read from register
    I2C_MasterReadByte(I2C_NAK_DATA);            // Read from register, last byte is NAKed
    I2C_MasterSendStop();                    // End of transaction

   

Not too difficult. Keep in mind that most of the APIs (except those for reading a byte) return a status byte which, when non-zero indicate an error condition.

   

The high-level APIs must be used in this way:

   

Writing to slave Count bytes
I2C_MasterWriteBuf(SlaveAddress,DataPtr,Count,I2C_MODE_COMPLETE_XFER);

   

Reading from Slave sending register byte first:
I2C_MasterWriteBuf(SlaveAddress,&RegAddress,1,I2C_MODE_NO_STOP);
I2C_MasterReadBuf(SlaveAddress,DataPtr,Count,I2C_MODE_REPEAT_START);

   


What slaves (Sensor? Link to datasheet?) are you connecting? Do not forget the pull up resistors on sda and scl lines.

   

 

   

Bob

PaHe_1325231
New Contributor

Again many thanks Bob, yes have my pull up resistors in place. The 4 components are:

   

http://www.freescale.com.cn/files/sensors/doc/data_sheet/MMA7660FC.pdf?fpsp=1

   

https://cdn-shop.adafruit.com/datasheets/BST-BME280_DS001-10.pdf

   

http://www.st.com/content/ccc/resource/technical/document/datasheet/c4/11/28/86/e6/26/44/b3/DM001126...

   

http://www.atmel.com/images/Atmel-8885-CryptoAuth-ATSHA204A-Datasheet.pdf

   

 

   

My small problem is up till now I have been a hardware/pcb guy and now I am catching up and teaching myself (trying) the firmware/software side too

   

Any and all help greatly received

   

 

   

Regards

   

 

   

Paddy

0 Likes
Bob_Marlowe
Expert II

An Irishman named Paddy! Its been a very long time past that I visited Ireland...

   

Care for the Atmel chip, the I2C address seems to be initially 0x64 which is not clearly listed in the datasheet.

   

 

   

Bob

0 Likes
PaHe_1325231
New Contributor

haha yes and a long line of Paddy's at that! what part where you in?

   

 

   

thanks for all the help

   

 

   

regards

   

 

   

Paddy

0 Likes
Bob_Marlowe
Expert II

Cork, Kerry, Dingle, Gap of Dunloe... some long trips on a motorbike... All roads marked "Not safe for horse caravans" were mine 😉

   

Bob

0 Likes
PaHe_1325231
New Contributor

Ah fab part, i'm on the east coast in drogheda. Really appreciate the help have given me an education in I2C and saved me PCB real estate as all my slave devices are on different I2C addresses

   

regards

   

 

   

Paddy

0 Likes