Jump to content
Sign in to follow this  
AGlass0fMilk

Limitations of UART (G2553)

Recommended Posts

Hello there.

 

For a project I am making, the Launchpad board must be able to communicate with my computer. Mostly the dataflow will be from the microcontroller to my computer, but I may introduce communication from the computer to the Launchpad sometime in the future. I am wondering a couple things at the moment (and may use this thread to ask further questions if I have any):

 

1. If I do not plan to have the computer send data to the microcontroller, can I have another G2553 send commands to the Launchpad using this line? (TXD to computer, RXD to another G2553)

 

2. If I plan to do the above, would it be possible to have the computer also communicate with the Launchpad on the RXD line as well as the other G2553 (I imagine I would use identifier bits when sending data packets to differentiate between the two sources). IE: TXD to Launchpad, RXD to another G2553 as well as the computer.

 

I am trying to do this so I can use the two I2C pins for ADC instead. I've never done I2C or communication between two microcontrollers before so any info (other protocols/methods, etc) you think would be useful can also be included.

 

Thanks.

Share this post


Link to post
Share on other sites

Don't know if transfer rate is important in your case, but UART transfer between PC and Launchpad is limited to 9600 bps due to Launchpad UART-USB bridge. UART transfer between 2 MSP430G2553 can go over 1 Mbps (with crossed RX/TX lines, and connected GND, without Launchpad). Also (hardware) UART RX/TX lines are working on same baudrate, and if one line (RX or TX) is configured on 9600 bps, other is limited to 9600 bps also.

Share this post


Link to post
Share on other sites

UART does support multiple senders, however, not all designs allow it.

In the olde days there where systems called RS-232, RS-422 and RS-485. The most successful of these on the consumer market was RS-232, which allowed for a point-to-point connection between a DTE (data terminal equipment) and a DCE (data circuit-terminating equipment), roughly translated to a PC and a modem (or mouse).

The other two RS standards did allow for multi-drop and multi-master respectively, roughly translating to multiple clients on a bus and multiple masters on a bus.

This means that UART (of which RS-232, RS-422 and RS-485 are subsets with extra electrical specifications) does support employing multiple masters and/or multiple slaves. You just need to have a good arbitration system.

 

Just to get the picture straight, do you want the PC to send (ie: TX) data to either of the launchpads in situation 2, or do you want one launchpad to be able to receive from the other launchpad and the PC?

+----------------+
|             TX |>-----+
| Launchpad 1    |      |
|             RX |<--+  |
+----------------+   |  |
                     |  |
+----------------+   |  |
|             TX |>--+  |
| Launchpad 2    |      |
|             RX |<-----+
+----------------+      |
                        |
+----------------+      |
|             TX |      |
| PC             |      |
|             RX |<-----+
+----------------+

Is this correct? I get kind of confused by your phrasing "RX to ..." since RX means receiving and this is always from something, not to.

 

As long as you have only a single TX connected to a wire (only one sender) you can do anything you want without problem (connecting vast lots of listeners may require a buffer, but that's not required for only 2 listeners)

Share this post


Link to post
Share on other sites

Just to give you an idea of what I'm trying to do, I plan on programming the independent (off-Launchpad) G2553 to backpack onto a keypad (I plan on it being modular so I can use it in other projects if I want to) in order to increase the number of available pins on the main microcontroller. I will probably make it possible to get keypress data from the independent G2553 through both UART and I2C so it will be a more universal keypad solution, but for this situation I would like to use the UART so I can use the I2C pins as ADCs instead.

 

I'll just give you a little diagram (as you did) for the two scenarios:

 

Scenario 1, Computer is able to receive data but not send it to the Launchpad, but Launchpad can receive data from another G2553:

+----------------+
|             RX |
| Independent    |      
|    G2553    TX |>--+  
+----------------+   |  
                     |  
+----------------+   |  
|             RX |<--+  
| Launchpad      |      
|             TX |>-----+
+----------------+      |
                        |
+----------------+      |
|             RX |<-----+
| PC             |
|             TX |
+----------------+

Scenario 2, Computer can send and receive data to/from the Launchpad, and the Launchpad can also receive data from the independent G2553 (doesn't need to send data back):

+----------------+
|             RX |
| Independent    |      
|    G2553    TX |>-------+  
+----------------+        |
                          |
+----------------+        |
|             RX |<-------+
| Launchpad      |        |
|             TX |>-----+ |
+----------------+      | |
                        | |
+----------------+      | |
|             RX |<-----+ |
| PC             |        |
|             TX |>-------+
+----------------+ 

Would both/either of these be possible? And what special considerations might I need to include in the design?

Share this post


Link to post
Share on other sites

Scenario 1: Yes, possible with no real effort.

 

Scenario 2: I think not just like this. The issue is that you connect two TX wires together, this means that you need to somehow detect that the other party is sending, or you need to set up a protocol for this. In addition, your PC is not by default able to let go of the TX wire, so you need to fix that someway.

Alternatively, you could use a second UART to receive data from the second source.

If you know that data is sparse, you could let the G2553 detect line availability using its RX input, you still need to guarantee that not both will send simultaneously.

+----------------+
|             RX |<---------+ Now we can detect whether the other party tries to send
| Independent    |          |
|    G2553    TX |>-------+ | 
+----------------+        | |
                          | |
+----------------+        | |
|             RX |<-------+ |
| Launchpad      |        | |
|             TX |>-----+ ^ |
+----------------+      | R | here is a resistor, so any transmission the PC does will be overridden by the G2553
                        | v | only if the G2553 sets its TX in high impedance the PC can send data, other data will be lost.
+----------------+      | | | alternatively, let the G2553 forward all data from the PC to the launchpad and do not directly connect the PC TX and the launchpad RX
|             RX |<-----+ | |
| PC             |        | |
|             TX |>-------+-+
+----------------+ 

Share this post


Link to post
Share on other sites

I think the alternative method would be the best option there. Data transfer from the PC to the Launchpad will be sparse (if I do it at all) so I could just include a sender identifier bit in the commands sent to the Launchpad from the G2553.

 

I'll try it out and check back, thanks for your help.

Share this post


Link to post
Share on other sites

As it stands, I do not think I am going to have the computer send any information so scenario 1 will be what I'm doing.

 

I just have a general circuitry question. The launchpad in question will be in quite a noisy (electrically and audio-wise) environment (it will be a MIDI controller). How can I limit the amount of jitter in my ADC lines? A small value ceramic cap to ground?

 

Edit:

The mcu software already checks new values to see if they are within a certain number of "clicks" of the old value.

 

I'm just wondering if there's a way through hardware to limit it in cases where there might be a lot of noise.

Share this post


Link to post
Share on other sites

Noise is a very separate sport, it does very much depend on what you consider noise and what you consider signal.

For the most simple cases you can get away with a simple 1st order low-pass filter; suppress all frequencies above a certain setpoint.

In this case, have a series resistor and a parallel capacitor:

tumblr_inline_mo4o8yRxJB1qz4rgp.png

The product of R (in ohms) and C (in farads) should be equal to 1/(2pi F), where F is your desired -3dB (50% suppression) frequency, from thereon every order of frequency (every 10 times as high a frequency) will be suppressed by another 10dB (90% suppression).

So if I want to suppress frequencies above 20kHz, I need R and C to produce the value of 1/(2pi 20,000) = 7.957,747*10-6 or about 8 micro ohmfarad. If I choose a capacitor of 22nF, I would need a resistor of 361.71 ohms, which is close to 360 ohms (which is a readily available resistor).

This means that 20kHz will be suppressed to 50% of its original amplitude, 200kHz will be suppressed to about 10%, 2MHz to about 1%, 20MHz to about 0.1% etc.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...