MC9S08QG4: BKGD/MS pin sharing with PTA4 output pin

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

MC9S08QG4: BKGD/MS pin sharing with PTA4 output pin

跳至解决方案
3,707 次查看
RoboTech
Contributor III
In our design (MC9S08QG4/8-pin), pin PTA4 is connected to the base of a transistor in a H-bridge with a 1k series resistor.

At power up, the pin is found at 1V and the MCU apparently starts in debug mode.

We tried to connect a pull up capacitor (1uF) from the same pin to Vcc, to keep the initial voltage above Vih before /Reset goes high.

Is this the correct solution and if so, how do we choose the capacitance value?
Otherwise, how can we guarantee that the MCU always starts correctly in user mode?

I haven't found any application notes about this matter and the reference manual does not provide much information either.

The strange thing about our solution is that if we try to shorten the time /Reset takes to go high, by using a smaller pullup resistor, so that MS is seen well above Vih, we can see the MCU starts up (because PTA4 goes low as initially expected), but then we can't communicate with the MCU via I2C.

Does anyone know what's going on?
标签 (1)
0 项奖励
回复
1 解答
979 次查看
bigmac
Specialist III
Hello,
 
I assume the transistor in the H-bridge is NPN, and you require to source current from the pin to turn the transistor on.  As you have found, PTA4 may not be the most appropriate allocation for this purpose.  The turn-on current through the 1k resistor will exceed the internal pullup current, and it also means that the transistor must initially conduct during POR, which may potentially also not be very satisfactory.
 
I think the use of a capacitor at the pin is problematic.  You would likely need a value significantly greater than 1uF to hold up the input for the required amount of time.  The presence of the capacitor will have other undesirable side effects.  Since the capacitor would need to charge or discharge whenever the output changed state, this would slow the switching operation, and place additional stress on the output pin.  You would also need to consider how the capacitor is to be discharged when power is removed - there is some potential for causing damage to the MCU.
 
If it is not possible to re-assign the I/O pins, I think you would need an additional buffer device between PTA4 and the NPN transistor.  This might consist of a P-channel MOSFET, or a PNP bipolar transistor (plus base resistor).  This would also ensure that the NPN transistor remained off during POR.
 
Regards,
Mac
 

在原帖中查看解决方案

0 项奖励
回复
3 回复数
980 次查看
bigmac
Specialist III
Hello,
 
I assume the transistor in the H-bridge is NPN, and you require to source current from the pin to turn the transistor on.  As you have found, PTA4 may not be the most appropriate allocation for this purpose.  The turn-on current through the 1k resistor will exceed the internal pullup current, and it also means that the transistor must initially conduct during POR, which may potentially also not be very satisfactory.
 
I think the use of a capacitor at the pin is problematic.  You would likely need a value significantly greater than 1uF to hold up the input for the required amount of time.  The presence of the capacitor will have other undesirable side effects.  Since the capacitor would need to charge or discharge whenever the output changed state, this would slow the switching operation, and place additional stress on the output pin.  You would also need to consider how the capacitor is to be discharged when power is removed - there is some potential for causing damage to the MCU.
 
If it is not possible to re-assign the I/O pins, I think you would need an additional buffer device between PTA4 and the NPN transistor.  This might consist of a P-channel MOSFET, or a PNP bipolar transistor (plus base resistor).  This would also ensure that the NPN transistor remained off during POR.
 
Regards,
Mac
 
0 项奖励
回复
979 次查看
RoboTech
Contributor III
Hi Mac,

Thanks for your suggestions. We're in fact replacing NPN transistors with PNP and adjusting the firmware to use inverted outputs. We cannot remap I/O pins and the capacitor seemed a quick and dirty solution at first, but not a very satisfactory one.

Moreover, we have the same problem in another board, using the same port to drive an IR transmitter, and the capacitor would be problematic with a 38kHz carrier.

Your comments have been much more helpful than the official support. Thanks again!

Paolo
0 项奖励
回复
979 次查看
irob
Contributor V
RoboTech, were you even able to turn the PTA4 pin into an output? Even after setting

SOPT1_BKGDPE = 0;

I'm unable to affect PTA4's state after POR.
0 项奖励
回复