Fmilburn 445 Posted November 6, 2016 Share Posted November 6, 2016 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 bluehash, veryalive, Tieri and 7 others 10 Quote Link to post Share on other sites
bluehash 1,581 Posted November 7, 2016 Share Posted November 7, 2016 Thanks @@Fmilburn! Quote Link to post Share on other sites
veryalive 49 Posted November 7, 2016 Share Posted November 7, 2016 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 failuresubdir_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 1gmake: 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) { WDT_A_hold(WDT_A_BASE); GPIO_setAsOutputPin(RED_LED); for(; { GPIO_setOutputHighOnPin(GPIO_PORT_P1,GPIO_PIN0); _delay_cycles(DELAY_CYCLES); GPIO_setOutputLowOnPin(GPIO_PORT_P1,GPIO_PIN0); _delay_cycles(DELAY_CYCLES); } } WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer return 0; } Quote Link to post Share on other sites
bluehash 1,581 Posted November 7, 2016 Share Posted November 7, 2016 From this e2e link, you may need to import a blank or example project and edit them. Quote Link to post Share on other sites
Fmilburn 445 Posted November 7, 2016 Author Share Posted November 7, 2016 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 Quote Link to post Share on other sites
veryalive 49 Posted November 7, 2016 Share Posted November 7, 2016 Thanks folks, I'll give that a try. cheers... Quote Link to post Share on other sites
nickds1 11 Posted January 17, 2017 Share Posted January 17, 2017 You could always use void GPIO_toggleOutputOnPin ( uint8_t selectedPort, uint16_t selectedPins Simplifies the loop code a bit... ) Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.