1
\$\begingroup\$

I need to daisy chain a number of slave pcbs, each with a NXP microcontroller to a master pcb with an esp32. The purpose of each slave is to interface to a motor control chip and handle CAN communication.

For an added level of redundancy the goal here is to "AND" the input enable signal to the motor control chip from the slave NXP GPIO and Master PCB (through the daisy chained cable) to enable the motor control on one specific slave.

Simply, is there a way to differentiate between the slaves just through one daisy chained signal (e.g. we only enable motor control chip on slave 0)? This signal from the master can be of our choosing, but goal is to use the minimal amount of cables (hopefully just one!)

enter image description here

\$\endgroup\$
6
  • 1
    \$\begingroup\$ Why do you need redundancy with that AND? In other word, why don't you only communicate via CAN? \$\endgroup\$
    – Julien
    Jul 25, 2023 at 18:41
  • \$\begingroup\$ We do communicate via CAN from esp32<>NXP to drive the "EN" high from the NXP, the purpose of this additional signal line is to add an extra layer of security, in that the NXP would have to command enable (even though yes it originates from the CAN message) as well as the master esp32 \$\endgroup\$
    – wgthompson
    Jul 25, 2023 at 18:49
  • \$\begingroup\$ Sorry, I'm not sure I understand. The NXP is your slave MCU? What is the purpose of this enable? Does it come from the master? \$\endgroup\$
    – Julien
    Jul 25, 2023 at 18:52
  • \$\begingroup\$ Your question is how to differentiate all the node? The obvious answer for me would be to enter a serial number in each of your MCU (either given by the master or in prod) and query that field. \$\endgroup\$
    – Julien
    Jul 25, 2023 at 18:52
  • \$\begingroup\$ Yes, the NXP is the slave MCU and the purpose of the enable is to allow the connected motor control IC outputs to be active \$\endgroup\$
    – wgthompson
    Jul 25, 2023 at 18:55

3 Answers 3

1
\$\begingroup\$

If you need a true single-wire solution, there is the aptly named 1-wire bus, which combines power and signaling into a single connection (you still need ground). There are a few addressable switches with GPIOs that I can find (no specific recommendations allowed, sorry). As the devices are powered off of the data bus, they are limited to sink capability only but that should not represent an insurmountable challenge.

\$\endgroup\$
1
  • \$\begingroup\$ thanks vir, this signal of interest is in addition to a bunch of other cabling I already have (including power and ground), apologies for not detailing that in the drawing \$\endgroup\$
    – wgthompson
    Jul 25, 2023 at 18:53
1
\$\begingroup\$

One way this could be achieved is by placing a shunt resistors that would be different on each board and measuring the current with the ADC. I don't really understand why somebody would get to all that trouble, but that's one way to do it!

\$\endgroup\$
7
  • \$\begingroup\$ ya your right, its alot of trouble .. and considering that the decision to enable motors at the end of the day is actually being made by the same processor (esp32), whether that be through CAN to the NXP or this additional signal \$\endgroup\$
    – wgthompson
    Jul 25, 2023 at 19:10
  • \$\begingroup\$ And thanks, this is one way to do it, only downside though is that this requires each slave to be a different board (shunt resistors must be of different values obviously..) \$\endgroup\$
    – wgthompson
    Jul 25, 2023 at 19:11
  • \$\begingroup\$ There are many way to achieve something similar, but at the end, (I don't know your application) but redundancy on a weaker link seems to me a bad idea. If you have noise on that enable line, your motor will stop for no reason. \$\endgroup\$
    – Julien
    Jul 25, 2023 at 19:13
  • 1
    \$\begingroup\$ do you think there is a way to send a square wave at a certain frequency (each slave has a unique frequency that it accepts) and through a comparator or something decipher this frequency to drive the EN signal .. \$\endgroup\$
    – wgthompson
    Jul 25, 2023 at 19:13
  • \$\begingroup\$ Regarding it's application, you can use several resistor in parallel to set it, so it is not that hard to design or manufacture, but... An other way would be with Time Domain Reflectometry. But it's for motivated people only! \$\endgroup\$
    – Julien
    Jul 25, 2023 at 19:15
0
\$\begingroup\$

Simply, is there a way to differentiate between the slaves just through one daisy chained signal (e.g. we only enable motor control chip on slave 0)? This signal from the master can be of our choosing, but goal is to use the minimal amount of cables (hopefully just one!)

Yes, sure. A basic serial line. A tiny 6-pin microcontroller (any really) can decode it. The tiny microcontroller has only one job then and can be easier to demonstrate that it will have desired reliability level. Those microcontrollers almost always have an ADC, so a single resistor can be used to "code" the slave number. That microcontroller can also have a serial input and output. On the input it receives a number. Compares to zero. If non-zero, sends it out after decrementing it by one. That way the slaves don't need to "know" their number - it becomes automatically assigned in sequence to each slave: 1st one has number 0, 2nd one number 1, etc. This daisy-chain still uses just one wire in addition to GND, but each line is a point-to-point connection between the microcontrollers.

Furthermore, you can use the break condition (line high) as a "global stop" signal, since that's easy to detect - most UARTS have a break detect status bit.

\$\endgroup\$
2
  • \$\begingroup\$ Thanks Kuba for your answer. Two things: 1. Placing a unique resistor value makes each slave board be different .. introduces problems for manufacturability 2. I am worried about noise throughout a UART system .. these PCBs are separated by a considerable distance (maybe up to 1 meter) and are in a noisy environment .. hence the use of CAN for primary communication \$\endgroup\$
    – wgthompson
    Jul 25, 2023 at 22:38
  • \$\begingroup\$ @wgthompson - The company I work for produces products that have a similar configuration as yours. We use small dip switches on the board to give them a unique (within the system) ID. These switches are set to the appropriate positions during final instrument assembly. All board testing prior to system assembly is done with the switches in their default position. \$\endgroup\$ Jul 26, 2023 at 14:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.