Detecting an active low signal

Rajinder

Jan 30, 2016
568
Joined
Jan 30, 2016
Messages
568
Hi all
I need some help with a problem.
I have 2 x PIC microcontrollers on seperate PCBs that communicate via SPI. They connect via a 8 pin header. One is a master the other the slave. I need to detect when tbe slave PIC has bern disconnected from the header.
I have MOSi, MISO,CLK and Slave select lines available 0V and 3V on the header. The slave select line is pulled high via a 47K resistor.
I only have one pin of the master PIC available, which is a I/O line.
Is there any way i can detect the slave select line using hardware?
I have no idea in how to do this.
Any help would be appreciated.
Thanks
 

AnalogKid

Jun 10, 2015
3,045
Joined
Jun 10, 2015
Messages
3,045
If you are talking about detecting a physical disconnect from the pc board connector, one of the easiest things to do is jumper together two of the removable connector pins. At the mating pc board connector, connect one pin to Vcc through a pull up resistor and to the PIC pin, and the other pin to GND. When the cable is plugged in, the PIC pin is grounded; when the cable is unplugged, the PIC pin is pulled high. Read the pin to get the connection status.

ak
 

Rajinder

Jan 30, 2016
568
Joined
Jan 30, 2016
Messages
568
Hi thanks for your reply.
I am not 100% sure what you mean.
I have a Vcc and Gnd on my connector aswell as the SPI pins.
Are you saying connect the VCC pin via a pull up and then feed to the PIC input I/O pin?
That i understand.
I am not sure what you mean by the other pin ?
Are you saying the other end of the pull up to 0V? Or are you saying the other end of the same connector pin but connected to 0V.
So in this situation when the 2 boards are connected the pin is 0V snd disconnected it is 3V. Is that what you are saying?
It seems to maje sense. I think.
Raj
 

AnalogKid

Jun 10, 2015
3,045
Joined
Jun 10, 2015
Messages
3,045
I'm saying that if there are two unused pins in the connector, you can use one pin on the PIC to sense when the connectors are mated, independent of any other signals on the connector. If the connector does not have two free pins, then we move on to another technique.

ak
 

Rajinder

Jan 30, 2016
568
Joined
Jan 30, 2016
Messages
568
Yes i get what you mean. However i only have one pin on the connector that is free.
What would be the best way to tackle this?
If for example there were no free pins could i use the SPI pins?
I am not sure on this.
Thanks for the help so far much appreciated.
 

AnalogKid

Jun 10, 2015
3,045
Joined
Jun 10, 2015
Messages
3,045
If you can modify the wire harness to tie the spare pin to either a Vcc or GND pin already on the connector, then it still can be used. If not, then can you post a pinout list of all of the pins and signals so we can see what we have to work with? Also, what is the connector type?

ak
 

Rajinder

Jan 30, 2016
568
Joined
Jan 30, 2016
Messages
568
Thanks for the reply.
I will post a pinout of the connections.
Its a 2x4 connector (2.54mm pitch) PCB mounted through-hole from SAMTEC.
This sits on the main PCB. The other smaller PCB has the mating end thst plugs into this.
I will get the signal pin outs for you.
Thanks again.
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
Why do you need 2 pins? On the detector side, connect the one free pin to Vcc through a pullup and the uC input. On the other side, connect that pin to ground.

Bob
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
Okay, I see, you are trying to do it by modifying only the connector. I envisioned the other connections on the boards.

Bob
 

Rajinder

Jan 30, 2016
568
Joined
Jan 30, 2016
Messages
568
Hi
The connections available on the main PCB are as follows
pin 1 VCC
pin 2 MISO
pin 3 MOSI
pin 4 CLK
pin 5 SS
pin 6 -
pin 7 -
pin 8 GND

I thought I was in luck with pins 6 and 7 as they do not connect to any other pin. However on the Top PCB that plug into this PCB pins 6 and 7 are as follows

pin 6 - is a active low RESET line that is pulled high to VCC with a 47K resistor and a 1K8 going to pin 6 of the connector
pin 7 - is a GPIO pin with a 1K8 from pin 7 going to the PIC

Could I use the RESET line i.e. pin 6, as it will be a high when the Top PCB is connected i.e. 47K and 1k8 (I presume 1K8 is used to protect the I/O line from current inrush). But will it be floating when disconnected? Not sure

Any help would be appreciated
 

AnalogKid

Jun 10, 2015
3,045
Joined
Jun 10, 2015
Messages
3,045
Could I use the RESET line i.e. pin 6, as it will be a high when the Top PCB is connected i.e. 47K and 1k8 (I presume 1K8 is used to protect the I/O line from current inrush). But will it be floating when disconnected?

Yes, probably floating enough.

The total pull up resistance is 48.8K. A pull down resistance of 220 K or more on your board should get you a logical low when the other board is removed, but not pull the reset line low when the board is connected. The higher the pull down resistance, the less loading on the reset line but the less firm the pulling down when the input is floating.

ak
 
Top