Jump to content
Sign in to follow this  
Agam

GPIO on CC3200 with Energia

Recommended Posts

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.

 

 

 

 

 

 

 

 

 

Share this post


Link to post
Share on other sites

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);
}

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


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.

Sign in to follow this  

×
×
  • Create New...