Resetting a slave from master mcu


+ Reply to Thread
Results 1 to 26 of 26
  1. #1
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,915

    Default Resetting a slave from master mcu

    See post #22:

    https://www.picbasic.co.uk/forum/sho...323#post156323

    A SN7407 Buffer works great!

    --------------------------------------------------------------------------------

    I have a reset button on the master PIC, and I'd like to reset all the slaves internally. This is what I have so far:




    I found formulas to calculate the base resistor, like this one:

    https://breadboardcircuits.com/how-transistors-work/


    But they're dependent on preliminary calculations done for the load current, and I have no clue how that is calculated with a PIC pin. I see several current loads in the datasheet for the 16F1933, but no clue which is the appropriate one to use in the formulas.
    Last edited by Demon; - 2nd October 2024 at 04:50.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  2. #2
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,956


    Did you find this post helpful? Yes | No

    Default Re: Resetting a slave from master mcu

    The main Load Current for the PNP transistor will come from the 10K, R5 resistor, that goes to +Vdd and not from the PIC /MCLR pin. Do not worry about that.

    Ioannis

  3. #3
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,915


    Did you find this post helpful? Yes | No

    Default Re: Resetting a slave from master mcu

    I had gotten that circuit from "somewhere", but I can't find any more. So, I'm looking at this guy:

    https://www.electro-tech-online.com/...d-reset.17256/

    He's using a NPN transistor, and I notice he's missing a pull-down on the base of the NPN.

    I added labels to make it clear what attaches where, and I end up with this:




    Do you see a problem if I have the programmer on the slave PIC at the same time as the pin from master PIC is connected?

    I can always unconnect everything when I program, but I know "one day", I'm gonna rush and program with everything connected.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  4. #4
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,956


    Did you find this post helpful? Yes | No

    Default Re: Resetting a slave from master mcu

    The base of the transistor is grounded through R6. The other end of R6 is Vss, meaning ground.

    To Reset the system you have to feed high to the transistor in this circuit.

    I am a bit worry about the collector that is connected to a 100 ohm and this to the programmer. In programming, there might be 13 or more volts. At this time you have to be sure that the transistor will be in OFF state, that is [/MCLR Slave from master PIC] be low. If you can be sure of this then I see no problem.

    Ioannis

  5. #5
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,915


    Did you find this post helpful? Yes | No

    Default Re: Resetting a slave from master mcu

    Yeah, this seems so sketchy to me. I'm thinking it would be safer to be able to connect only one at a time; either the programmer, or the master PIC.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  6. #6
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,915


    Did you find this post helpful? Yes | No

    Default Re: Resetting a slave from master mcu

    I ended up with this design, using tri-state pin on master to reset all the slaves when required. This will not be used for programming the slaves, only resets.

    Name:  Slave MCLR from master TRI-STATE.png
Views: 465
Size:  42.0 KB


    It's simple, uses a single general I/O pin on master, and no extra components on slaves.

    I include that 100R res on slaves "just in case" I need them one day with my Pik-Kit.


    EDIT: For those that want to ICSP as well, look at the SN7407, and thank Mr E for the info (master on Input A, slave on Output Y)
    Last edited by Demon; - 31st May 2024 at 21:49.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  7. #7
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,956


    Did you find this post helpful? Yes | No

    Default Re: Resetting a slave from master mcu

    What drives the MCLR pin of the slaves? A PIC output?

    I am asking, because the MCLR pin needs a level of 0,2*Vdd to see LOW (for the 16F177x series, but I guess it is the same for others).

    It depends on output characteristics if you are within limits of the MCLR. So be sure that what you think as low is actually sensed as low on the MCLR pins.

    Ioannis

  8. #8


    Did you find this post helpful? Yes | No

    Default Re: Resetting a slave from master mcu

    you could do in software..... send out to one or all listeners a command to goto a restart routine like.... which "provides a way to execute a MCLR in software"
    ,
    ,
    ,
    restarting:
    @ RESET

  9. #9
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,915


    Did you find this post helpful? Yes | No

    Default Re: Resetting a slave from master mcu

    Quote Originally Posted by amgen View Post
    you could do in software..... send out to one or all listeners a command to goto a restart routine like.... which "provides a way to execute a MCLR in software"
    ,
    ,
    ,
    restarting:
    @ RESET

    But will that work if the slave is caught in a loop or some such?

    I'm aiming for a complete reset with no decision from the slave.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  10. #10
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,915


    Did you find this post helpful? Yes | No

    Default Re: Resetting a slave from master mcu

    Quote Originally Posted by Ioannis View Post
    What drives the MCLR pin of the slaves? A PIC output? ...
    A tri-state general I/O pin on the master.

    Output low = reset
    Input = do nothing


    Quote Originally Posted by Ioannis View Post
    ...

    I am asking, because the MCLR pin needs a level of 0,2*Vdd to see LOW (for the 16F177x series, but I guess it is the same for others).

    It depends on output characteristics if you are within limits of the MCLR. So be sure that what you think as low is actually sensed as low on the MCLR pins.

    Ioannis
    I can't say. This is all theory for now, but is supported by posts on google and a forum elder, Mr E.

    So I blame him if my house burns down.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  11. #11


    Did you find this post helpful? Yes | No

    Default Re: Resetting a slave from master mcu

    But will that work if the slave is caught in a loop or some such?

    I'm aiming for a complete reset with no decision from the slave.
    could do.........
    1)
    '
    restarting:
    pause 1000 ............... wait a second or 2 to reset all
    @ RESET
    '
    or 2)................
    if all slaves are on same 5 or 3 volt supply, then use a small NC (normally closed) relay to turn off power for few seconds to restart all slaves

  12. #12
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,915


    Did you find this post helpful? Yes | No

    Lightbulb Re: Resetting a slave from master mcu

    I figured out an easier way to MCLR a PIC from another; a simple diode.

    Name:  MCLR slaves from master.png
Views: 360
Size:  20.2 KB


    I was fixated on that darn pull-up to VDD:

    - pull-down MCLR on Slave.
    - 1N4001 diode from GP pin on Master.
    - 100R towards ICSP.

    And that's it. I just tested it, and there's never more than 5V on Master-side of diode.

    I can't believe it was so simple.


    I have one last test to do; check how much current is running from Master.

    EDIT: I see a quick pulse of 16-17mA when I'm programming via ICSP. I'm not sure how I can manage that.
    Last edited by Demon; - 29th September 2024 at 23:17.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  13. #13


    Did you find this post helpful? Yes | No

    Default Re: Resetting a slave from master mcu

    MCLR's have internal weak pullups in chip.....

    Name:  icsp.JPG
Views: 358
Size:  32.3 KB

  14. #14
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,915


    Did you find this post helpful? Yes | No

    Default Re: Resetting a slave from master mcu

    What diode are you using? Did you put it on backwards?

    Like Ioannis said, ICSP runs a whole bunch of volts through that line.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  15. #15
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,915


    Did you find this post helpful? Yes | No

    Default Re: Resetting a slave from master mcu

    I got my better multimeter and got:

    - 15mA surge
    - 0.43mA continuous

    The surge is just that, an instantaneous burst. Considering I/O pins on the 16F18877 are rated for absolute maximum 50mA, and most PICs are rated for 2-25mA, I don't think a burst of 15 or a few more mA is something to be worried about.

    Name:  MCLR current continuous.png
Views: 349
Size:  147.4 KBName:  MCLR current surge.png
Views: 349
Size:  117.1 KB
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  16. #16
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,915


    Did you find this post helpful? Yes | No

    Default Re: Resetting a slave from master mcu

    Quote Originally Posted by amgen View Post
    could do.........
    1)
    '
    restarting:
    pause 1000 ............... wait a second or 2 to reset all
    @ RESET
    '
    or 2)................
    if all slaves are on same 5 or 3 volt supply, then use a small NC (normally closed) relay to turn off power for few seconds to restart all slaves

    What is the @ RESET command? (I'm using PBP3.1)

    I prefer to avoid relays and mechanical devices. Contacts generally consume more current than ICs and discretes, and contacts wear out.

    I've got an order for some SN7407N from Digikey; gonna check out Mr E's suggestion.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  17. #17


    Did you find this post helpful? Yes | No

    Default Re: Resetting a slave from master mcu

    diodes can be like signal diodes 1N4148. Not backwards in order to pull MCLR low to reset and that is considering you do LOW VOLTAGE PROGRAMMING setting, if not doing that then would use the 2n3906 or any NPN to pull down all the slaves through the diodes. The @ RESET is an assembly instruction using the @ for PBP to do machine code directly ( I think you know all that stuff)...... so if you want a hard reset after ICSP then yes to use MCLR but if chips are running, you could give instruction to GOTO reset.

    Name:  reset.JPG
Views: 344
Size:  125.9 KB

  18. #18
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,915


    Did you find this post helpful? Yes | No

    Default Re: Resetting a slave from master mcu

    Quote Originally Posted by amgen View Post
    ... diodes can be like signal diodes 1N4148. Not backwards in order to pull MCLR low to reset and that is considering you do LOW VOLTAGE PROGRAMMING setting...
    Nah, I'm doing regular ICSP programming for now, but I'm considering using ZIF socket adapter for programming, and then installing the PICs on IC sockets.

    The nice thing with IC sockets, I can't damage the PIC while soldering. A dab of hot glue at both ends should stop the PIC from falling out.


    Quote Originally Posted by amgen View Post
    ... The @ RESET is an assembly instruction using the @ for PBP to do machine code directly ( I think you know all that stuff). ...
    I graduated back in '83, was 2nd in my assembler classes. But I've never used it in my professional career as mainframe programmer.


    Quote Originally Posted by amgen View Post
    ... if not doing that then would use the 2n3906 or any NPN to pull down all the slaves through the diodes.
    Can you explain this like I'm 5? I looked at NPN and PNP transistors but I can't figure out how to do that.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  19. #19


    Did you find this post helpful? Yes | No

    Default Re: Resetting a slave from master mcu

    crap, I figured you were a kid ..... I always put the pics in sockets, saves a lot of F-ups. For transistor, logic level MOSFET is good to use. The logic level means it will be full on with 5 volts on gate, no resistors required.... N-channel like BS170 ... with this, the reset is a high pulse on master...(dah)
    Name:  icsp.JPG
Views: 328
Size:  60.6 KB
    Last edited by amgen; - 1st October 2024 at 00:47.

  20. #20
    Join Date
    May 2013
    Location
    australia
    Posts
    2,485


    Did you find this post helpful? Yes | No

    Default Re: Resetting a slave from master mcu

    I'm doing regular ICSP programming for now
    any pic programmer worth its salt can program chips that support LVP in "regular ICSP" mode without that nasty hv pulse being needed at all
    Warning I'm not a teacher

  21. #21
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,915


    Did you find this post helpful? Yes | No

    Default Re: Resetting a slave from master mcu

    Quote Originally Posted by richard View Post
    any pic programmer worth its salt can program chips that support LVP in "regular ICSP" mode without that nasty hv pulse being needed at all
    Low-voltage programming is not used by melabs programmers and should always be disabled in the configuration settings.
    https://melabs.com/support/icsp.htm


    I'm gonna take my PicKit4 out of storage and give it another shot.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  22. #22
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,915


    Did you find this post helpful? Yes | No

    Default Re: Resetting a slave from master mcu

    Quote Originally Posted by amgen View Post
    crap, I figured you were a kid .....
    I'm a kid at heart, and I get out of bed at the same speed as them.


    Quote Originally Posted by amgen View Post
    ..... I always put the pics in sockets, saves a lot of F-ups....
    Yeah, I'd hate to notice a mistake at the end of assembling my boards.


    Quote Originally Posted by amgen View Post
    ... For transistor, logic level MOSFET is good to use. The logic level means it will be full on with 5 volts on gate, no resistors required.... N-channel like BS170 ... with this, the reset is a high pulse on master...(dah)
    I finally got a few SN7407 thanks to Mr E's suggestion a while back. This runs awesome, and I have room for 6 slaves, that should be enough for my boards.

    Name:  MCLR slaves from master.png
Views: 191
Size:  31.3 KB


    I don't have to worry about the surges up towards the Master during programming the Slave.

    (Which is good, cause my MeLabs U2 programmer doesn't do LVP, and I can't get my PicKit4 to run properly).
    Last edited by Demon; - 2nd October 2024 at 04:52.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  23. #23
    Join Date
    May 2013
    Location
    australia
    Posts
    2,485


    Did you find this post helpful? Yes | No

    Default Re: Resetting a slave from master mcu

    Quote Originally Posted by Demon View Post
    I don't have to worry about the surges up towards the Master during programming the Slave.
    No, but the 120 ohm pullup will be a pin killer if the vdd is 5v
    Warning I'm not a teacher

  24. #24
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,915


    Did you find this post helpful? Yes | No

    Default Re: Resetting a slave from master mcu

    Quote Originally Posted by richard View Post
    No, but the 120 ohm pullup will be a pin killer if the vdd is 5v
    Yeah, I was blindly following SN7407 datasheet. I don't really care about timing, so I upped it to 1K pull-up.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  25. #25
    Join Date
    May 2013
    Location
    australia
    Posts
    2,485


    Did you find this post helpful? Yes | No

    Default Re: Resetting a slave from master mcu

    Yeah, I was blindly following SN7407 datasheet. I don't really care about timing, so I upped it to 1K pull-up.
    given that I-inh max for a SN7407 gate is 40uA and a pic output pin could drive more than 20 of them and still produce a clean TTL signal.
    i cannot see that signal timing would even be a consideration. just what need does the pullup fulfill ?
    Warning I'm not a teacher

  26. #26
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,915


    Did you find this post helpful? Yes | No

    Default Re: Resetting a slave from master mcu

    Quote Originally Posted by richard View Post
    given that I-inh max for a SN7407 gate is 40uA and a pic output pin could drive more than 20 of them and still produce a clean TTL signal.
    i cannot see that signal timing would even be a consideration. just what need does the pullup fulfill ?
    Except from preventing the input pin on the SN7407 from floating, I don't see one for my application.

    I don't really care about "precision timing"; I just trigger the MCLR reset on the Slave with a 10usec pause. I still have a pull-up downstream on the Slave PIC.

    Code:
    SlaveMCLR = 0
    PauseUS 10
    SlaveMCLR = 1

    EDIT: I figured I'd read the instructions AFTER posting that reply.

    11.1 Layout Guidelines: ... All unused inputs of digital logic devices must be connected to a high or low bias to prevent them from floating.
    Promptly runs over to breadboard to pull down the other 5 unused inputs.
    Last edited by Demon; Yesterday at 19:41.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

Similar Threads

  1. Master to slave 16F767
    By sachymo in forum General
    Replies: 6
    Last Post: - 3rd June 2008, 20:22
  2. I2C Master Slave issues.
    By cpayne in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 29th March 2008, 19:33
  3. PIC master slave howto
    By RFsolution in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 18th September 2007, 22:35
  4. 1 slave 1 master 1 MAX232 1 problem ?
    By SuB-ZeRo in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 31st July 2005, 22:59
  5. i2c master/slave
    By lab310 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 8th April 2005, 22:23

Members who have read this thread : 11

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts