TCPIP ENC28j60 and MCP 23017

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Roy Johnston
Flowcode V4 User
Posts: 205
Joined: Mon Aug 24, 2009 8:38 am
Has thanked: 2 times
Been thanked: 34 times
Contact:

TCPIP ENC28j60 and MCP 23017

Postby Roy Johnston » Sun Jul 03, 2016 12:50 pm

The TCPIP ENC28j60 makes use of the SDI pin (mis0).
This pin is also used for my I/O expander chips (MCP 23017).
The question is can we use this pin simultaneously on both components.

User avatar
Rudi
Posts: 666
Joined: Mon Feb 10, 2014 4:59 am
Has thanked: 494 times
Been thanked: 188 times

Re: TCPIP ENC28j60 and MCP 23017

Postby Rudi » Sun Jul 03, 2016 1:43 pm

Roy Johnston wrote:The TCPIP ENC28j60 makes use of the SDI pin (mis0).
This pin is also used for my I/O expander chips (MCP 23017).
The question is can we use this pin simultaneously on both components.


do you really want connect an I2C Portexpander to the SPI ?
or do you overlap config I2C on same Mosi Pin?

FYI:
the MCP23017 is a High-speed I2C™ interface (MCP23017)
- 100 kHz
- 400 kHz
- 1.7MHz

the MCP23S17 is a High-speed SPI interface (MCP23S17)
- max 10 MHz

you can connect more ( total 8 ) devices total of this Portexpander.
you setup the adress by A0, A1, A2 by connecting it to high or low, that is then the co adress for your device
your total adress of the device is then build with the base address and co adress..

read the datasheet first please
( click on the blue underline text now, its a link, you see in the status bar left side bottom in your browser the target line of the link )

Roy Johnston
Flowcode V4 User
Posts: 205
Joined: Mon Aug 24, 2009 8:38 am
Has thanked: 2 times
Been thanked: 34 times
Contact:

Re: TCPIP ENC28j60 and MCP 23017

Postby Roy Johnston » Sun Jul 03, 2016 2:25 pm

Thanks Rudi,
I am currently successfully using the (MCP23017) chip, I use 4 of them for port expanders.
pin 33 on the 18f4550 is used in the hardware connection for the (MCP23017).

Now the problem is that the TCPIP ENC28j60 makes use of the SDI pin (mis0) also requires the use of pin 33 ,
it seems I cannot use the mcp23017 and enc28j60 at the same time with the 18f4550 chip.

the question is can I simply parallel pin 33 to both chips. or do I need to redesign my pc board to suit a chip with two sdi channels.
or can I simply set any pins on the enc28j0 component to use the software option.

User avatar
Rudi
Posts: 666
Joined: Mon Feb 10, 2014 4:59 am
Has thanked: 494 times
Been thanked: 188 times

Re: TCPIP ENC28j60 and MCP 23017

Postby Rudi » Sun Jul 03, 2016 3:54 pm

Roy Johnston wrote:Thanks Rudi,
I am currently successfully using the (MCP23017) chip, I use 4 of them for port expanders.
pin 33 on the 18f4550 is used in the hardware connection for the (MCP23017).

Now the problem is that the TCPIP ENC28j60 makes use of the SDI pin (mis0) also requires the use of pin 33 ,
it seems I cannot use the mcp23017 and enc28j60 at the same time with the 18f4550 chip.

the question is can I simply parallel pin 33 to both chips. or do I need to redesign my pc board to suit a chip with two sdi channels.
or can I simply set any pins on the enc28j0 component to use the software option.


on fast way, i shoot this out:

Yes, you can use this part to drive both a IIC bus and a SPI bus in the same circuit.
However, you can't (reasonably) use the single MSSP module of this device to drive both busses.


If possible, instead of doing this, I'd use the Hardware SPI and set up a software ( bitbang ) I2C on another couple of pins

please read this

example PIC16(L)F1503
read side 164 in datasheet
The MSSP module can operate in one of two modes:
• Serial Peripheral Interface (SPI)
• Inter-Integrated Circuit (I2C™)


please read in Pic18F4550 datasheet for MSSP - can it operate in "one" or "and" modes.
honest, do not know from head. look to the part of MSSP

usually i do this so:
because SPI is faster, i use the SPI as Hardware. ( OLED Display, ENC28J60, µSD-Card )
for I2C ( sensors, serial flash ) , i use then on other pins a software i2c ( bitbang )

normaly it is not a problem to use the same pin for each ( SPI Mosi , I2C SDA )

You can normally mix ( overlap ) I2C and SPI on the same pins.
I2C only does something between START and STOP.

The SPI HW Interfaces work parallel to the CPU so you must wait for it that is done..

inform you here more about mixing

and here a good info is this

You can normally mix I2C and SPI on the same pins. I2C only does something between START and STOP.
START is when SCL is HI, SDA goes to HI->LO.
STOP is when SCL is HI and SDA goes LO->HI.
So if you arrange your code such that SDA only changes value when SCL is LO, there will be no problems.
The I2C will not notice any SPI transactions. Of course all the SPI devices have thier own individual CS pin, but this is the disadvantage of SPI.


on sure way, perhabs PIC18F4550 user can here better help you.
or wait for the staff on monday.


hope this helps
best wishes
rudi ;-)

Roy Johnston
Flowcode V4 User
Posts: 205
Joined: Mon Aug 24, 2009 8:38 am
Has thanked: 2 times
Been thanked: 34 times
Contact:

Re: TCPIP ENC28j60 and MCP 23017

Postby Roy Johnston » Sun Jul 03, 2016 6:40 pm

Thank you,
seems very complicated to get both to work,
probably better to get a chip with several spi channels.