I²C with external SDA driver.

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

cross mob
Anonymous
Not applicable

Is there any possibility to get this in PSoC4? I am planning to use it with special 24V drivers to communicate with PLC. SDA and SLC will be driven with PLC 24VDC Digital Outputs and level shifted to PSoC. To send back data from PSoC I need SDA output wich is not the same pin to drive it to Digital input on PLC.

0 Likes
1 Solution
Anonymous
Not applicable

What you are describing sounds an awful lot like a CAN bus from the automotive industry. Perhaps, try using/implementing something similar to that? It allows for multiple devices on the same two wires, has a fast enough speed to handle the rates you describe, only requires 2/3 wires, and implements arbitration which you would need to deal with if you have multiple devices on the same bus.

If you are just wanting some method of transmitting data to your devices with: a global clock wire, and a data input/output specific to each device, then you might just have better luck bit-banging it with an interrupt routine in software. Since you only need 200 ms per 16 bits, then you could pretty easily setup your application to toggle the pins as you toggle the clock.

(Set clock high, set data pins, wait x ms, set clock low, wait x ms, repeat for each bit of x bytes of data to transmit/receive)

View solution in original post

0 Likes
3 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

I2C pins are open collector with pull up resistors. This applies to SDA and SCL (clock stretching). So yout interface needs to level-shift from 24V to PSoC level and an OC output.

Bob

Anonymous
Not applicable

OK, maybe my question was not well defined. I²C by default is 2 wire interface, where IO have only 2 states (Z and Q with logical 0). In PLC world there is no possibilities to have the same pin as input and the same time as output. So in case when data is transfered to uC - I use PLC digital output, in case when slave is transfering data back (Or making ACK) I need physical different pin on uC to give data to PLC Input pin wich is different from data out pin. My goal is to make something similar to SPI (SCK, MOSI, MISO) but without Slave select pin. In this case I need only 3 wires. For SPI SS is necessary only to detect start and stop for the frame, but I²C this is encoded allready in SCL and SDA sequences. Maybe there is some way how to upgrade SPI driver to autodetect frame boginning and frame end from SCK and MOSI signals. In this case I have 2 features at the same time - no SS pin necessary, Data can be transfered in bouth directions at the same time. Speed from PLC to SLAVE will be pretty slow (DO modules are working not faster than 5ms cycle normally). To make one pulse on output I need to spend 10ms. 16bit variable will take 160ms + Start and Stop stuff. It means 200ms 16bit - that means 5x in every second I can transfer 16bit both ways. In PLC world thats more or less is OK if there is no special communication processors on board. Goal is to make extremely simple communication SLAVE using PSoC 4 wich can drive 4PWM, read 4Analog Inputs, Read 8 Digital inputs and all this can be controlled and read using just ordinary 2digital outputs on PLC and 1 digital input. If there is more than 1 slave - CLK output can be used for all slaves the same - that means if I have 8 slaves I need 9 Digital outputs and 8 Digital inputs. This configuration is almost all PLCs - but possibilities with this configuration is not even close to standart PLCs (8 x 4PWM channels for example or 8 x 4 Analog inputs).

0 Likes
Anonymous
Not applicable

What you are describing sounds an awful lot like a CAN bus from the automotive industry. Perhaps, try using/implementing something similar to that? It allows for multiple devices on the same two wires, has a fast enough speed to handle the rates you describe, only requires 2/3 wires, and implements arbitration which you would need to deal with if you have multiple devices on the same bus.

If you are just wanting some method of transmitting data to your devices with: a global clock wire, and a data input/output specific to each device, then you might just have better luck bit-banging it with an interrupt routine in software. Since you only need 200 ms per 16 bits, then you could pretty easily setup your application to toggle the pins as you toggle the clock.

(Set clock high, set data pins, wait x ms, set clock low, wait x ms, repeat for each bit of x bytes of data to transmit/receive)

0 Likes