This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

synchronise two PWM signal between two MCU with différent ground level

i like to synchronise two PWM signal between two MCU http://focus.ti.com/lit/ds/symlink/msp430f2101.pdf , this mcu are located in two different place and supplied with two battery cell, so i used to output the clock of mcu1 and this will be the clock for timer_A, but this clock is 32 KHZ i am worried about the delay time, have you please an idea about this ?

  • Do they have indeed two different GND levels or jsu ttwo different dupplies? To submit any kind of electrical signal, you need a common GND. electrical signals are based on current flowing, and to have current flow, you need two poles.
    If oyu indeed have two different systems with different (independent) GND levels, such as in isolated systems, you'll need an opto coupler or a magnetic coupler (see the ADUM chips from analog devices). Here you'll indeed notice a slight delay. However, compared to the 32kHz clock, the delay is not really noticeable (the ADUMs are for 1MHz operation and more, and even the cheaper optocouplers do not impose a delay that is in the range of a 32kHz clock signal)

    To give you further advice, you should be a bit more detailed with your project info. And about your exact worries 8why do you worry exaclty about a possible clock delay?)

  • Dear Jean-Michael, this two MCU are supplied with different cell battery( range from 2.65V to 3.3V), so for this reason i need to isolate the two MCU i used this opto  http://www.farnell.com/datasheets/13113.pdf , i need to output two PWM from the two MCU with a perfect synchronization==> the timer should be synchronized, but i have another idea instead of using the first clock to be the clock of the second timer, indeed i want to use a synchro signal that will output from MCU1 to MCU2 and generate an interrupt to activate the timer of MCU2, and i calculate the delay that timer2 ( MCU2) take to start after the interrupt, and insert thisdelay before starting timer1 ( MCU1), i willl use the DCO for the two MCU instead of the quartz oscillator, isn't a good idea ?

  • If the reason is jus tthe different supplys, then you can simply connect the two GND. The MSP running on 3.3V will easily detect the 2.65V signals from teh other one.
    And for the opposite direction, a small series resistor (1k) will limit the clam current that from from teh 3.3V high output through the clamp diodes to the 2.65V supply. The ~0.4V overvoltage (diode voltages and output drop already removed) will cause 200µA clamp current on a 2k series resistor.
    The current required for driving the opto is significantly higher (5mA min).

    Yassine Akrmi said:
    i willl use the DCO for the two MCU instead of the quartz oscillator, isn't a good idea ?

    The DCO differs between MSP and drifts with temperature. You'd need to constantly resynchronize and still be never sure. Not to mention the resolution problem when the two MSPs do not have the same core clock. You'll lose cycles without noticing.

    It would be best to put a crystal to the MSP with the lower voltage (but it is basically meaningless with the series resistor), output its MCLK or SMCLK (full crystal frequency!) to a port pin an duse this signal as input into the oteh rMSPs XT1 input (configurign its clock for digital clock input rathe rthan crystal).

    Thsi keeps the CPU clock (and therefore the timer clocks if derived from the same signal) in sync. All you then have to do is somehow synchronizing the start moment of the timers. THis might be a bit more difficult.

    You should set one the first MSPs CCR0 unit to emit a pulse when the timer rolls over to 0. the other MSP will capture its own current timer value when this signal comes and knwo its own offset. Yuo can then use this offset to correct the second MSPs timer by programming the CCR0 with a correction value for one PWM cycle. If this is done properly, the two timers are 100% in sync, independently of code cycles etc.

  • but the problem is the two mcu are supplied qith different cell battery ===> so two different ground, i don't know in this case if the solution that you give can resolve the problem

  • for the DCO i think that there is a solution :  each MSP is calibrated at the factory for 1, 8, 12, and 16 MHz (+/- 1%), and these settings are stored into the MSP's information memory so that user's can copy those calibrated values into the DCO's configuration registers at run time,  just include these two lines of code to configure the DCO:

    for 1MHz

      DCOCTL = CALDCO_1MHZ;
      BCSCTL1 = CALBC1_1MHZ;

  • Yassine Akrmi said:
    but the problem is the two mcu are supplied qith different cell battery ===> so two different ground,

    If there is no other reason for two different grounds than just the existence of two different batteries, then you can just connect the two grounds to one. Then both sides are on the same GND level and work perfectly with each other.
    Separate grounds (and an optocoupler) are only necessary if you for some reasons mus tnot connect the grounds. Maybe because one side's ground is also connected to maybe a live wire, while the other has human-touchable interface connections.

**Attention** This is a public forum