Jump to content
43oh

How to access the UART via Enregia within CSS 6.1.x


Recommended Posts

  • Replies 33
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

You can't have both the Launchpad TX/RX connected and the BT device.  Pull the jumpers and connect the BT device directly to P1.1 and P1.2

Posted Images

Hi Rickta59,

 

Thank you for the reply. The function name in my code is serialEvent, rather than serialEventRun, because of seeing this construct in HardwareSerial.cpp:

 

void serialEvent() __attribute__((weak));
void serialEvent() {}
#ifdef SERIAL1_AVAILABLE
void serialEvent1() __attribute__((weak));
void serialEvent1() {}
#endif

 

void serialEventRun(void)
{
 if (Serial.available()) serialEvent();
#ifdef SERIAL1_AVAILABLE
 if (Serial1.available()) serialEvent1();
#endif
}

 

serialEvent in HardwareSerial.cpp is called by the main function, as expected.  But as  that serialEvent is defined with __attribute__((weak)) that means that the definition in my code, not defined with weak, will override the definition in Hardwareserial.cpp, right?

 

Thank you,

Link to post
Share on other sites

It is not calling my function because

 

Serial.available()

 

is returning false.

 

Perhaps the BT device is connected incorrectly ? (It is powered on by the Launchpad and can be seen by other BT devices, Its RX is to MCU's TX (P!_2) and its TX is to MCU's RX (P1_1). And the Launchpad jumpers are set to hardware UART.

 

How would I read the results back without Serial Event?

 

BTW, I set CSS breakpoints in the Enegia RX interrupt handler and they are not triggered.

 

Ideas?

 

Thank you!

Link to post
Share on other sites

With  the BT device connected directly to P1.1 and P1.2 here is what I tried

 

- Removed/pulled both J3 jumpers TXD and RXD. Code Composer Studio would not see the Launchpad (even though it is plugged into USB)

 

- Reinstalled the J3 jumpers to the software UART position, rather than the hardware positions they were in before, and CCS would see the Launchpad and be able to use the debugger on it. But there are still no calls to serialEvent (like the BT device is not responding or the Launchpad is not detecting the response).

 

 

Another way, when you wrote "You can't have both the Launchpad TX/RX connected and the BT device." does that mean one cannot with CSS debug the code on the Launchpad while the BT device is connected?

 

 

Do you think I am understanding what you are saying?

 

Link to post
Share on other sites

The MSP430G2553 Launchpad has only one serial port. You can use it to talk to your PC via USB through the backchannel or you can use it to talk to your device. But not both simultaneously. You do have some options.  One is to create a software serial port using unused I/O lines on the 2553 to act as your second serial port. Perhaps a simpler, more expedient option is to use a Launchpad that supports multiple serial ports (MSP430F5529 or MSP432 Launchpads, for example).

 

EDIT:  Looks like @@Rickta59 answered while I was typing. 

Link to post
Share on other sites

Here is a picture of the Launchpad. The two jumpers outlined in green are removed from the board and it is communicating OK with CSS and the debugger.

 

Still, it seems no traffic is being received from the BT device to the Launchpad (serialEvent is not being called). I can see, via tracing with the debugger, that the string "AT+RESET\r\n" is being placed, by Energia code, into the UART output buffers. 

 

Thank you,

post-48698-0-48446300-1462468354_thumb.jpg

Link to post
Share on other sites

Well the bluetooth device is serial / slave only . . . so there should be no reason to use the UART any other way. Simply pair to the system in question, and then it should present its self as a COM device in windows, or a tty device under Linux.

 

Aside from that I could not say if it's possible to debug an whatnot other than using SBW or not . . .

 

Also just a friendly heads up. That device you bought for 10 bux off amazon, you can buy 3-4 off ebay for the same price, and free shipping . . . They're known as HC-06 slave mode bluetooth devices. There is also an HC-05 which can operate as a master bluetooth node too . . .

Link to post
Share on other sites

Yes eBay will be a better choice for the next ones! it is OK for it to be slave only for this intended application.

 

Yyrkoon, have you been able to make this BT device work with your Launchpad?

 

Rickta59, yes on the msp430g2553 it is connected to the TX on the BT device. and TX on msp430 to RX on BT device.

 

That is a cool idea about jumping RX/TX. I will try it!

Link to post
Share on other sites

Rickta59,

 

At your suggestion I jumpered the UARTs RX and TX together and whatever was Serial.print()  showed up on the Serial.read(). So perhaps either the BT device is jumpered wrong or it is just not responding?

 

(BTW: The BT device defaults to 9600 baud, which is what the UART has been set to)

 

Thoughts?

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.


×
×
  • Create New...