|
|
View previous topic :: View next topic |
Author |
Message |
ntc
Joined: 18 Mar 2015 Posts: 8
|
|
Posted: Sun Jan 03, 2016 8:31 pm |
|
|
Hi everybody
I've a problem when connect with MCP23S17.
Can I configure a MCP23S17 output and input at the same time?
Example, I make an output on GPA0 and read the input on GPA1 (GPA0 and GPA1 connected together) at the same time?
Please help me solve this problem.
Thank you. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19543
|
|
Posted: Mon Jan 04, 2016 10:30 am |
|
|
Why?.
The 23S17, has a separate DO and DI pin. No need to combine. The 23017, is I2C, therefore using open collector drive with pull-ups, so the bi-directional data can be handled without problems. Trying to combine DI and DO, puts you in the position that after your output pin clocks the 'read' command, both this pin, and the SDO pin on the second chip will be trying to drive the signal at once. Result overheating and excess current. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19543
|
|
Posted: Tue Jan 05, 2016 2:28 am |
|
|
If you are talking about the chip's I/O pins, then you can configure one pin as input, and another as output (in the IPOL register), and read one, and write to the other, but not 'simultaneously'. You are going to have to do a write transaction on the GPIO register to set one pin, and then a read transaction to read the other. However you then have the big 'why' question, since if you are driving the pin, then you know whether it is driven high or low, unless it is being shorted to driven high by an external source. If the latter is the case, then you are back to shorted pins, and potential overloads..... |
|
|
ntc
Joined: 18 Mar 2015 Posts: 8
|
Output Connection of 23S17 |
Posted: Thu Jan 07, 2016 7:12 pm |
|
|
Thanks for your advice!
In my project, I want to check the connection of wire bus ( check short of copper wires) so that I want to use any pins of 23S17 to control input or output.
I get an example, i have a wire bus which has connections as below
1(GPA0)----------------------2 (GPA1)
|------3 (GPA2)
|------4 (GPA3)
{GPA1,2,3 have a 10K pulldown resistor}
I'll check short of wire bus of terminal 1 have connected with terminals 2, 3, 4.
If all connected, the wire bus is OK, otherwise is NG.
I think I write a program as below:
1) set GPA0 to high
2) check input GPA1,2,3, if all is high -> OK, otherwise is NG
Because the wire bus have many connections so that, I'll write a GUI on PC to control input and output of any pins, so that I have a problem when input and output have the same port of one 23S17 IC.
If this solution is not OK, can you have show me which IC can control input and output single ?
Thank you. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19543
|
|
Posted: Fri Jan 08, 2016 1:45 am |
|
|
OK. That makes sense. No need for 'at the same time', and good reason to want to be able to read the signal.
One question though. Could you limit the current involved?.
Add a series resistor to the GPA0 output, that limits the current to 20mA max. So if you are running off 5v, 250R. So if the output line is shorted, the maximum current that can flow is 20mA (5/250 = 0.02A). This avoids the danger of the chip actually being damaged if the line is shorted, and also reduces the risk to your supply circuitry which is delivering the current.
All you have to do is program the IODIRA register (0), to 0xFE (so bit 0 is the only 'output'), then set bit 0 of the OLATA register (0xA), to turn on GPA0, then read the GPIOA register (9), and test bits 1,2 & 3. |
|
|
ntc
Joined: 18 Mar 2015 Posts: 8
|
|
Posted: Fri Jan 08, 2016 8:55 pm |
|
|
Ttelmah wrote: | OK. That makes sense. No need for 'at the same time', and good reason to want to be able to read the signal.
One question though. Could you limit the current involved?.
Add a series resistor to the GPA0 output, that limits the current to 20mA max. So if you are running off 5v, 250R. So if the output line is shorted, the maximum current that can flow is 20mA (5/250 = 0.02A). This avoids the danger of the chip actually being damaged if the line is shorted, and also reduces the risk to your supply circuitry which is delivering the current.
All you have to do is program the IODIRA register (0), to 0xFE (so bit 0 is the only 'output'), then set bit 0 of the OLATA register (0xA), to turn on GPA0, then read the GPIOA register (9), and test bits 1,2 & 3. |
Thanks for your advices
I forgot about the current limit, a large bug :D
It help me fix a bugs in a new project.
I'll tried to build a circuit with testboard, write a program and feedback the result.
Thank so much |
|
|
ntc
Joined: 18 Mar 2015 Posts: 8
|
Slew rate control |
Posted: Mon Jan 11, 2016 7:20 pm |
|
|
Hi.
I tried to write a program to test with your instructions.
Also I used 23S17 driver of CCSC compiler to control. Everthing is OK.
But I have an amazing with slew rate control of this IC. Is it only support
slew rate for I2C mode, or both (MCP23S17 and MCP23017) ?
Pls help me.
Thanks you. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Jan 11, 2016 10:20 pm |
|
|
The data sheet says it's for SDA. It doesn't say it's for SDO.
Here is what it says:
Quote: | The Slew Rate (DISSLW) bit controls the slew rate
function on the SDA pin. If enabled, the SDA slew rate
will be controlled when driving from a high to low. |
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|