Jump to content
zeke

Console with One-Wire Temperature on MSP430F5529 LP

Recommended Posts

Hi Guys,

 

This has been on my bucket list for a while.

 

I've put together a CCS6 project that gives the user a serial console to the MSP430 with the ability to read a DS18B20 sensor by issuing a serial command.

 

Here's a copy-paste of some of my interactions on the console:

*************************************************************************************
* CommandConsole Ver:0.1 Released by:RandomElectrons.com Built:Sep 22 2014 16:33:28 *
*************************************************************************************
h
*******************************************************************************
B,b: Banner command
C,c: Clear screen command
H,h: Help command
M,m: Memory command
R,r: Reset command
S,s: Sensitivity command
T,t: Temperature command
V,v: Version command
*******************************************************************************
OK
t?
T=254 raw decimal counts
T=15.87'C
OK
t?
T=213 raw decimal counts
T=-13.31'C
OK
T?
T=29 raw decimal counts
T=-1.81'C
OK
T?
T=9 raw decimal counts
T=-0.56'C
OK
T?
T=6 raw decimal counts
T=0.37'C
OK
T?
T=242 raw decimal counts
T=15.12'C
OK
B?
T=440 raw decimal counts
T=27.50'C
OK

I have also uploaded my CCS6 project as a zip file.

 

As the pictures suggest, I have created this on an F5529 LaunchPad board.

 

The DS18B20 is wired up in 3-Wire mode and is connected to P1.4 of the LP and read with the typical bit-banging method. 

 

I have wired in an adafruit ftdi friend onto P3.3 and P3.4 for USART to the PC operation.

 

I use the Terminal inside of CCS6 to interact with the system.

-->View-->Other-->Terminal-->OK

 

The console portion of this project was inspired by and adapted from http://www.adnbr.co.uk/articles/parsing-simple-usart-commands

 

Comments are welcomed.

 

post-112-0-87595500-1411426557_thumb.png

post-112-0-42113300-1411426564_thumb.png

RE_OneWireOnF5529LP.zip

Share this post


Link to post
Share on other sites

I am using baud rate 115200 but I am getting different characters. The code seems to be working, I can read the temperature values but I am not getting correct characters in the COM port. What might I be doing wrong?

Share this post


Link to post
Share on other sites

@@acesh

 

Have you made any alterations to the original code?

 

Make sure to set your serial port to 115200, 8N1.

 

Can you show us what you see?   Please copy-paste your console output here.

Share this post


Link to post
Share on other sites

@@acesh

 

There's something not quite right with the communication parameters. 

 

If the communication parameters are truely 115200,8N1 then try changing the encoding to ASCII.

Share this post


Link to post
Share on other sites

The encoding options are ISO-8859-1, UTF-8 and Cp1252. What should I use? Can you walk me through the connection of the FTDI Friend?

 

Thanks

Share this post


Link to post
Share on other sites

Hi guys.

I used Zeke's sw a long time ago, so maybe my recollection is correct / useful:

.... Check your bit times with a scope ....?

 

I recall changing baud rate down to 9600 and also got bit errors.

The logic analyser showed faster bit times than 104 uSec (9600), it was around 95 or 97 ?

When I adjusted dividers in the async uart setup routine, it worked.

Maybe this helps?

Cheers....

Share this post


Link to post
Share on other sites

This is obviously wrong:

 

 UCSCTL2 |= 499;                           // Set DCO Multiplier for 16MHz
                                            // (N + 1) * FLLRef = Fdco
                                            // (499 + 1) * 32768 = 16MHz
change to...

 

 UCSCTL2 |= 499;                           // Set DCO Multiplier for 16MHz
                                            // (N + 1) * FLLRef = Fdco
                                            // (499 + 1) * 32768 = 16.384 MHz
and also change...

 

 const unsigned long smclk_freq = 16384000UL; // SMCLK frequency in hertz
and delete (or fix and make use of)...

 

/*******************************************************************************
 *
 ******************************************************************************/
#define F_CPU 16000000UL
#define BAUD 19200
#define BAUD_PRESCALE (((F_CPU / (BAUD * 16UL))) - 1)

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

×