Agam 0 Posted September 21, 2016 Share Posted September 21, 2016 Hi, Previously I was using CC3200 launch pad for developing my module. But now I want to use GPIOs and control leds etc on launch pad. When using normally, I used digitalWrite(pinnumber,1); But now I want to control led etc using GPIO. How to accomplish that in Energia. I have seen peripheral library for cc3200 , but I am not able to use it. Kindly help asap. Quote Link to post Share on other sites
roadrunner84 466 Posted September 21, 2016 Share Posted September 21, 2016 Does this help? Note that the LEDs are labeled to be connected to pin 9, 10 and 29 for yellow green and red resp. Quote Link to post Share on other sites
energia 485 Posted September 21, 2016 Share Posted September 21, 2016 Are you referring to the GPIO driverlib API's for the CC3200? Please see this for GPIO: http://software-dl.ti.com/ecs/cc31xx/APIs/public/cc32xx_peripherals/latest/html/group___g_p_i_o___general___purpose___input_output__api.html and this for the complete driverlib API's: http://software-dl.ti.com/ecs/cc31xx/APIs/public/cc32xx_peripherals/latest/html/index.html You can #include <driverlin/xyz.h> in your Sketch and then call any of the driverlib API's. #include <driverlib/gpio.h> void setup() { //Configure PIN_15 for GPIO Output MAP_PinTypeGPIO(PIN_15, PIN_MODE_0, false); MAP_GPIODirModeSet(GPIOA2_BASE, 0x40, GPIO_DIR_MODE_OUT); } void loop() { //Set Pin 15 to 1 MAP_GPIOPinWrite(GPIOA2_BASE,GPIO_PIN_6,GPIO_PIN_6); //Set Pin 15 to 1 delay(1000); //Set Pin 15 to 0 MAP_GPIOPinWrite(GPIOA2_BASE,GPIO_PIN_6,0); delay(1000); } Quote Link to post Share on other sites
Agam 0 Posted September 30, 2016 Author Share Posted September 30, 2016 I used your code. I saw that PRCm clk for GPIOA2 was not Enabled. But I got the error as :- In file included from Blink.ino:1:0: C:\energia-0101E0014-windows\energia-0101E0014\hardware\cc3200\cores\cc3200/driverlib/gpio.h:121:49: error: 'tBoolean' has not been declared extern long GPIOIntStatus(unsigned long ulPort, tBoolean bMasked); ^ My code is:- #include "driverlib/gpio.h" #include "Energia.h" #include "inc/hw_ints.h" #include "inc/hw_memmap.h" #include "inc/hw_timer.h" #include "inc/hw_types.h" #include "debug.h" #include "interrupt.h" #include "timer.h" #include "driverlib/prcm.h" #include "inc/hw_gprcm.h" #include "wiring_private.h" #include "driverlib/rom_map.h" #include "driverlib/pin.h" void setup() { //Configure PIN_15 for GPIO Output PRCMPeripheralClkEnable(PRCM_GPIOA2,PRCM_RUN_MODE_CLK); MAP_PinTypeGPIO(PIN_15, PIN_MODE_0, false); MAP_GPIODirModeSet(GPIOA2_BASE, 0x40, GPIO_DIR_MODE_OUT); } void loop() { //Set Pin 15 to 1 MAP_GPIOPinWrite(GPIOA2_BASE,GPIO_PIN_6,GPIO_PIN_6); //Set Pin 15 to 1 delay(1000); //Set Pin 15 to 0 MAP_GPIOPinWrite(GPIOA2_BASE,GPIO_PIN_6,0); delay(1000); } Kindly respond. Quote Link to post Share on other sites
Agam 0 Posted September 30, 2016 Author Share Posted September 30, 2016 Hi , Actually it is working when I commented GPIOINTStatus function in gpio.h file. But I would like to ask how to know which pin is on which Gpio base and what is 0x40 etc.... Main issue is unable to get pin mapping. Quote Link to post Share on other sites
energia 485 Posted October 4, 2016 Share Posted October 4, 2016 pin mapping is quite complicated on the CC3200. You'll have to dig into the datasheet and user manual to get a grasp of what goes where and how to map them. Stick to Energia API's as much as possible unless you are OK with going down into the rabit hole of pin mapping. You could also try the pinmux cloud tool from TI. It will generate .c/.h files for you from which you can copy past into an Energia Sketch. The pimux utility for CC3200 can be found here: https://dev.ti.com/pinmux/app.html#/config/CC3200/ID_500/ID_0/null/null It does require a TI account. Robert 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.