This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

practicing GIPO in cc3200

Other Parts Discussed in Thread: CC3200

/*
 * main.c
 */
// Standard includes
#include <stdio.h>

// Driverlib includes

#include "hw_types.h"
#include "hw_ints.h"
#include "hw_memmap.h"
#include "hw_common_reg.h"
#include "hw_apps_rcm.h"
#include "prcm.h"
#include "gpio.h"
#include "utils.h"
#include "pin.h"
#include "hw_gpio.h"


extern void (* const g_pfnVectors[])(void);
void port_init()
{
		// Enable Peripheral Clocks Must do before setting direction
		PRCMPeripheralClkEnable(PRCM_GPIOA1, PRCM_RUN_MODE_CLK);

		// Configure GIPO9
	    PinTypeGPIO(PIN_64,PIN_MODE_0,false);
	    GPIODirModeSet(GPIOA1_BASE,0x2,GPIO_DIR_MODE_OUT);

	   // Configure GIPO10
	    //
	    PinTypeGPIO(PIN_01, PIN_MODE_0, false);
	    GPIODirModeSet(GPIOA1_BASE, 0x4, GPIO_DIR_MODE_OUT);

	    //
	    // Configure GIPO11
	    //
	    PinTypeGPIO(PIN_02, PIN_MODE_0, false);
	    GPIODirModeSet(GPIOA1_BASE, 0x8, GPIO_DIR_MODE_OUT);


}


int main(void)
{
	port_init();

	while(1)
	{
		GPIOPinWrite(GPIOA1_BASE,0x2,1);
		GPIOPinWrite(GPIOA1_BASE, 0x4,1);
		GPIOPinWrite(GPIOA1_BASE, 0x8,1);

	}
}

i wrote above code to glow all LED, but all LED goes OFF anyone please check and tell what i go wrong or what i did'nt  understand , please

  • Hi Vignesh,


    Please refer blinky example from SDK.


    Regards,
    Aashish
  • try this.

    GPIOPinWrite(GPIOA1_BASE,0x2,0x2);
    GPIOPinWrite(GPIOA1_BASE, 0x4,0x4);
    GPIOPinWrite(GPIOA1_BASE, 0x8,0x8);

    - kel
  • thanks kel, i solved that before, i forgotten to update this thread,.  I have a problem with uart rx now 

    i successfully transmitted with UART ,but having trouble in receiving in UART

    [ connection: TX (pin3 ) connected to RX (pin4)] 

    // Standard includes
        #include <stdio.h>
    
     // Driverlib includes
    
    	#include "rom.h"
    	#include "rom_map.h"
        #include "hw_types.h"
        #include "hw_ints.h"
        #include "hw_memmap.h"
        #include "hw_common_reg.h"
        #include "hw_apps_rcm.h"
        #include "prcm.h"
        #include "gpio.h"
        #include "utils.h"
        #include "pin.h"
        #include "hw_gpio.h"
    	#include "uart.h"
    
    	#define UART_BAUD_RATE  9600
        unsigned long int cchar;
    
    /// GLOBLA VARIABLE 	///
    
    
        extern void (* const g_pfnVectors[])(void);
      void port_init()
         {
    
             // Enable Peripheral Clocks Must do before setting direction
                PRCMPeripheralClkEnable(PRCM_GPIOA1, PRCM_RUN_MODE_CLK);
                PRCMPeripheralClkEnable(PRCM_UARTA0, PRCM_RUN_MODE_CLK);
    
             // Configure GIPO9
                PinTypeGPIO(PIN_64,PIN_MODE_0,false);
                GPIODirModeSet(GPIOA1_BASE,0x2,GPIO_DIR_MODE_OUT);
    
               // Configure GIPO10
                PinTypeGPIO(PIN_01, PIN_MODE_0, false);
                GPIODirModeSet(GPIOA1_BASE, 0x4, GPIO_DIR_MODE_OUT);
    
               // Configure GIPO11
                PinTypeGPIO(PIN_02, PIN_MODE_0, false);
                GPIODirModeSet(GPIOA1_BASE, 0x8, GPIO_DIR_MODE_OUT);
    
                // Configure PIN_03 for UART0 UART0_TX
                PinTypeUART(PIN_03, PIN_MODE_7);				//tx
    
                // Configure PIN_04 for UART0 UART0_RX
    
                 PinTypeUART(PIN_04, PIN_MODE_7);				//rx
    
         }
      void uart_init()
      {
    
    	  PRCMPeripheralReset(PRCM_UARTA0);
    	  UARTConfigSetExpClk(UARTA0_BASE,PRCMPeripheralClockGet(PRCM_UARTA0),UART_BAUD_RATE,(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |UART_CONFIG_PAR_NONE));
    	  UARTFIFODisable(UARTA0_BASE);
    	  UARTEnable (UARTA0_BASE);
      }
    
      int main(void)
         {
    
    
    	       PRCMCC3200MCUInit();
               port_init();
               uart_init();
    
               while(1)
                {
            	 //  cchar =UARTCharGet(UARTA0_BASE);
            	   while(UARTCharsAvail(UARTA0_BASE) == false)      // waiting to receive packet
            	   {
            	   }
            	    cchar =UARTCharGetNonBlocking(UARTA0_BASE);      // get received data
            	   if(cchar == 1)
            	   {
            		   GPIOPinWrite(GPIOA1_BASE,0x2,2);				//turn on red led
            		   GPIOPinWrite(GPIOA1_BASE,0x8,0);
            		   GPIOPinWrite(GPIOA1_BASE,0x4,0);
            		   UARTCharPut(UARTA0_BASE,cchar);				//send back command
            	   }
            	   if(cchar == 2)
            	       {
            	          GPIOPinWrite(GPIOA1_BASE,0x2,0);				//turn on orange led
            	          GPIOPinWrite(GPIOA1_BASE,0x8,8);
            	          GPIOPinWrite(GPIOA1_BASE,0x4,0);
            	          UARTCharPut(UARTA0_BASE,cchar);		//send back command
            	       }
            	   if(cchar == 3)
            	       {
            	          GPIOPinWrite(GPIOA1_BASE,0x2,0);				//turn on green led
            	          GPIOPinWrite(GPIOA1_BASE,0x8,0);
            	          GPIOPinWrite(GPIOA1_BASE,0x4,4);
            	          UARTCharPut(UARTA0_BASE,cchar);			//send back command
            	       }
                }
           }
    

    
    

    It's always waiting in while loop not passing, i even checked by sending command externally from PC (USB to UART bridge converter) , but it can transmit data to PC,but not receiving

     

  • Hi,

    Currently I have no time to review your code thoroughly.

    Try cchar == '1', if it will turn on led if your press 1 at your keyboard. Also, see uart_demo example program.

    - kel
  • thanks for reply even in ur busy time,

    i found that it working with ON BOARD UART TO USB,

    But when i connect directly with external UART TO USB( Silicon Lab CP210X, popular converter with 6pin) ,MCU succeessfuly transmitting,
    but its not receiving , i mean MCU did not know that it receiving UART signal ( UART receive flag is not set when giving UART signal, as result UARTCharsAvail() return Only FALSE )
  • Hi Vignesh,

    If you are using the uart_demo and the characters are not echoed back using the UART TO USB converter, then there might be some problem with the use of UART TO USB converter. But, check also if there needs to be some jumpers that needed to be set at your CC3200 LP.

    - kel
  • HI Vignesh,


    As Markel suggested please try with UART_demo example first then modify application as per your requirement. As it will be easy for us to debug the issue if you are able to create issue with SDK example.


    Regards,
    Aashish
  • thanks ashish , i moved to setup wifi ,i will check that later.

    i created new project (NON OS-  i set this in ARM Linking ->file search path)

    i copied list of function from NON OS related example (mDNS),to my main.c

    void SimpleLinkHttpServerCallback(SlHttpServerEvent_t *pHttpEve   SlHttpServerResponse_t *pHttpResponse)
    
     void SimpleLinkNetAppEventHandler(SlNetAppEvent_t *pNetAppEvent)
    
     void SimpleLinkSockEventHandler(SlSockEvent_t *pSock)
    
     void SimpleLinkWlanEventHandler(SlWlanEvent_t *pWlanEvent)
    
     static void InitializeAppVariables()
    
     static long ConfigureSimpleLinkToDefaultState()

    i tried to set device as wifi station. so did following things

    1. called initializeAppVariables()

    2.then called configuresimplelinktodefaultstate()

    inside that function sl_start() does not returning any value ,its hangs in that function (i checked by printing characters above and below the function sl_start() )

    
    

  • Hi Vignesh,

    What exactly are you trying to do? Have you gone through the CC3200 Getting Started Guide? If not go through the guide to get familiarity with setting up WiFi.

    It is a good idea to use a working example program as base for your development.

    - kel
  • kel,

    i just practicing with cc3200, as you told to use ti's example as base,    i did ,it was comfortable and easy to use example program as base . thanks

    my aim to buy this is to  data logging to web page, this CC3200 will collect machine detail and post it  to webpage., (my friend is web developer  I asked some help ,he asking me ,what database will this IC support,sadly he dont know about http,tcp....transport layer of networking).

    now i need help in http client example  , how can i see that cc3200 is posting json string (i mean POST DATA) in web.. usart  out put of this example plainly saying it POSTED jason data  on httpbin.org host and 80 port., how to check that...... sorry if this is very noob question, i don't know about network ( but little know about HTML)

  • Hi Vignesh,


    You may try with http://posttestserver.com server in place of httpbin.org to test POST request


    Regards,
    Aashish
  • thanks Aashish,

    is it possible to make http server as public? i mean access those webpages remotely when it was connected to wifi with internet connection

    Aashish

  • Hi Vignesh,


    There should be no issue if you have static IP for your internet connection. Please refer e2e.ti.com/.../1300365 for details.


    Regards,
    Aashish