Sign in to follow this  
Followers 0
Dortol

Sending data via USB to another USB

8 posts in this topic

Hi there,

first of all sorry but I am a greenhorn in programming a µController :-/

I set myself a new goal that I program a tiny tool to measurer timings of a self made shutter electronic for a camera.

For this I would like to send a String by pushing button1 at my MSP430G2553 LaunchPad. The string should be sending via USB connection to PC and again to another USB Port.

The hardware at the end of the second USB Port will drive a solenoid. The primary purpose is to measure the delay between sending at the LaunchPad and receiving the driver signal of the solenoid driver.

The problem is, I have no idea how does the communication is possible :-/

At this days I understand how some ENERGIA examples does work and I can program some parts by my own. Possibilities of communication is totally new for me.

Please could someone give me some tips on how to solve that ?

 

I am grateful for all information.

Share this post


Link to post
Share on other sites

The G2553 chip itself does not have USB support. You can go through the LaunchPad's "application"/"backchannel" UART; you firmware then just needs to write/read the UART. You also need an application on the host PC to read from one COM port and write to another.

But why use USB? Why can't you control the solenoid directly from the LaunchPad?

bluehash, NurseBob and Dortol like this

Share this post


Link to post
Share on other sites

@Dortal,

As @Clavier noted, you should be able to fire the solenoid directly from the MSP430G2553, which would eliminate the likely significant communication latency the USB scenario you described would introduce. There are timer examples for the MSP that are analagous to your experiment which should not be too difficult to adapt.

Re: USB support - You would need to use one of F5529 launchpads, which have native USB support (not as a as a controller, just as a USB device).  There is a USB Developer's library via MSPWare with code examples.

Bob

 

Dortol likes this

Share this post


Link to post
Share on other sites

Thanks a lot for that support. I will try to realize it by UART between the electronic parts.

Share this post


Link to post
Share on other sites

Posted (edited)

Upcoming question is how I send a digital HIGH at PIN11 (2.3)

It doesn't work. Why ?..

const int PINttl = 11;

const int ButtonOne = 33;



Int PINttlState = 0;

Int ButtonOneState = 0;



void setup() {

pinMode(PINttl, OUTPUT);

pinMode(ButtonOne, OUTPUT);

}

void loop() {
ButtonOneState = digitalRead (ButtonOne);

// the following should be a beginner solution to generate a static PWM signal about 50% OnTime

if (ButtonOneState == LOW) {

   digitalWrite(PINttl, HIGH);

   delay(500);

   digitalWrite(PINttl, LOW);

   delay(500);

}

else {

    digitalWrite(PINttl, LOW);

}

}

 

Edited by bluehash
[ADMIN] Please use code tags<> next time. Thank you!

Share this post


Link to post
Share on other sites

Also, are you using an msp430g2553? If so, you probably want to use the PUSH2 constant instead of 33.

Share this post


Link to post
Share on other sites

Thank you very much.

OK, this code works very well as a basic solution for PWM with synchronous LED blink.
 

#define LED RED_LED

const int PINttl = 11;
const int ButtonOne = PUSH2;

int PINttlState = 0;
int ButtonOneState = 0;

void setup() {
pinMode(PINttl, OUTPUT);
pinMode(ButtonOne, INPUT_PULLUP);
pinMode(LED, OUTPUT);
}

void loop() {
ButtonOneState = digitalRead (ButtonOne);

// PWM signal about 50% OnTime with synchronous LED blink
if (ButtonOneState == LOW) {
     digitalWrite(PINttl, HIGH);
     digitalWrite(LED, HIGH);
     delay(50);
     digitalWrite(PINttl, LOW);
     digitalWrite(LED, LOW);
     delay(50);
 }

else {
    digitalWrite(PINttl, LOW);
    digitalWrite(LED, LOW);
 }
}

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0