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.

CONFIGURE GPIO via UART COMMANDS

Other Parts Discussed in Thread: MSP430G2553

Hi all,

I am using MSP430 launchpad. I want to configure GPIO from serial port of MSP430G2553. For example I'll send a command like "set BIT 5 of PORT1 as ADC", to configure Port 1 Bit 5 as ADC. 

Is there an easy way to do that?

  • Gurhan Zihni said:
    Is there an easy way to do that?

    No.

    Let's break that down into smaller chunks...

    1. You need to develop (or obtain) a working UART driver that can receive characters from an external host. That part is fairly easy (although stay away from the TI examples, they tend to be horrible). There are lots of examples in this forum if you search for them.

    2. You would need to develop a set of functions that can take your port number, port bit, and desired mode as parameters and make the changes to the appropriate GPIO control registers (like P1SEL, P1DIR, etc). Tedious, but also not too difficult.

    3. You need a language parser to parse out natural language, interpret this, and make the appropriate function calls described in item #2. This is the difficult part.

    Is what you want impossible to do? No. It's just not easy, especially for a beginner.

    But if you are willing to learn, I would suggest going in the order I listed above, and come back here with specific questions if you run into problems. Break it down into bite-size chunks.

  • Suppose you succeeded in doing so, what next?

    Are you going to expand the Command in order to set up the ADC (for example)?

    And Commands to activate the ADC? And Commands to get the readings of ADC? And Commands to process the readings? ...

    What is the end-game?

  • old_cow_yellow said:

    Are you going to expand the Command in order to set up the ADC (for example)?

    Yes. I'm going to configure ADC, Port and Timer registers.

    I'm trying to build a home automation system. Pins must be configured from a remote unit. There are several components like temperature and occupancy sensors, magnetic contacts, relays, buttons etc. User will have ability to change pin functions. For example assign button_1 for light_1, button_2 and button_3 (like vavien) for light_2 etc.

    I'm testing functions and components in MSP430 Launchpad. The final mcu will be more skillful. Thank you for your reply.

**Attention** This is a public forum