4 years, 9 months ago.

How to set serial TX pin low

I need to be able to set a serial TX pin low so that I can power cycle a device connected to the serial port. I will be using either the KL05Z or the KL25Z. When I disable power to the connected device, I need to make sure that all signals to the device are in the low state, otherwise the device may be powered through one of its input pins. Typically there are protection diodes on these pins which are tied to VCC. I thought of the break function, but this does not hold it low.

Also, is it posible to have code which executes before the constructors at the top of the program?

Thanks, Tom

'Hang' the device to the +VCC line and use digital out pin to control the GND connection (set low to enable device). You may need a driver transistor of FET depending on the power needed for the device. Does the device have an ultra low power standby mode? in which case leave it connected and use that function, Xbee's are a typical example for this mode.

posted by Paul Staron 11 Feb 2015
Comment on this question

1 Answer

4 years, 9 months ago.

Code won't execute before the constructors, construct them in your main function if you like that. If you need global variables you can have global pointers to those objects, and in your main let them point to your newly constructed objects.

Regarding setting TX pin low: Probably easiest is to first make it a low DigitalOut before switching it to Serial.

Setting it low before switching it to Serial might be enough, but ideally I would want to switch it back. The idea is if I can't communicate with the connected device, I cycle its power and try again.

Thanks, Tom

Tom

posted by Tom Russell 11 Feb 2015

You need to log in to post a question