Important changes to questions
We’re making some changes to Mbed Questions. From 10th December 2019 this site will be archived and new questions should be asked on our new forum site. Until that date you can continue to reply to existing questions here but can’t ask new questions.
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
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.
You need to log in to post a question
'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