Jump to content

DriverLib Examples for the MSP430F5529

Recommended Posts

Energia and Arduino users eventually get to the point where they need more direct access to the hardware if they take on more complicated projects.  In addition to the direct access of registers using the provided header files, TI offers DriverLib which contains abstractions for accessing the peripherals.


To better understand the peripherals, and to check out DriverLib, I recently created 20+ short examples for my own edification.  All of them were written for the MSP430F5529 LaunchPad and most of the peripherals are covered.  In some cases pushbuttons, LEDs, resistors, potentiometer, etc. are required that you probably have on hand.  A multimeter is required, and in some cases an oscilloscope and logic analyzer are instructive but not necessary.



DriverLib SPI Example 13A_USCI_B_SPI_MCP41010_digiPot


All of the examples are located here:  https://github.com/fmilburn3/MSP430F5529_driverlib_examples


It is necessary to have some understanding of the registers before using DriverLib because the DriverLib documentation doesn't describe how the peripherals and their registers work.  The documentation for registers is located in the User

Link to post
Share on other sites

Thank you @@Fmilburn


Your article got me interested, again, in driverlib.   In fact, I was not able to get it working when I first tried some months ago, and I'm having the same problem as I did on my first attempt.


Here's an open question to you or the forum  -----> 


When I try driverlib, I can't get CCS to find it in my computer's file system; likely a path problem; despite trying, I've been unable to solve it  ---   any ideas, folks?


Here's Frank's simple 'blink' which I tried today and the CCS error output......   (I underlined the offending line.




**** Build of configuration Debug for project test-5229-drvlib-1 ****
"C:\\ti\\ccsv6\\utils\\bin\\gmake" -k all
'Building file: ../main.c'
'Invoking: MSP430 Compiler'
"C:/ti/ccsv6/tools/compiler/msp430_15.12.3.LTS/bin/cl430" -vmspx --data_model=restricted --use_hw_mpy=F5 --include_path="C:/ti/ccsv6/ccs_base/msp430/include" --include_path="C:/ti/ccsv6/tools/compiler/msp430_15.12.3.LTS/include" --advice:power=all -g --define=__MSP430F5529__ --diag_warning=225 --diag_wrap=off --display_error_number --silicon_errata=CPU21 --silicon_errata=CPU22 --silicon_errata=CPU23 --silicon_errata=CPU40 --printf_support=minimal --preproc_with_compile --preproc_dependency="main.d"  "../main.c"
>> Compilation failure
subdir_rules.mk:7: recipe for target 'main.obj' failed
"../main.c", line 2: fatal error #1965: cannot open source file "driverlib.h"
1 catastrophic error detected in the compilation of "../main.c".
Compilation terminated.
gmake: *** [main.obj] Error 1
gmake: Target 'all' not remade because of errors.
**** Build Finished ****



and the code...

#include <msp430.h> 
#include "driverlib.h"
#define  DELAY_CYCLES  1045000

 * main.c
int main(void) {

   for(; {
}  WDTCTL = WDTPW | WDTHOLD;	// Stop watchdog timer
	return 0;

Link to post
Share on other sites

Hi @@veryalive,
I find it easiest to do as @@bluehash suggests and specify a blank DriverLib project in CCS at the bottom of the window when creating a project and before pasting in code. It can also be imported after creation as described in the MSP430 Design Workshop.


EDIT:  Back at my computer again...  The selection I am referring to is highlighted at bottom left in the attached photo




Link to post
Share on other sites
  • 2 months later...

Join the conversation

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

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...