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.

CCS/RM48L952: Toggling of GPIO pin

Part Number: RM48L952
Other Parts Discussed in Thread: HALCOGEN

Tool/software: Code Composer Studio

Hey there,

I am facing a problem in toggling my GPIO pin

Firstly I am setting it to 1(HIGH)

In the next statement I am toggling my same pin but on my board it is not toggling.

The Control card is TMDXRM48CNCD and here is my code composer studio file

Please provide help

* Include Files */

#include "sys_common.h"
#include "system.h"
#include "gio.h"

/* USER CODE BEGIN (1) */
/* USER CODE BEGIN (2) */
/* USER CODE END */

/* USER CODE END */

/** @fn void main(void)
*   @brief Application main function
*   @note This function is empty by default.
*/
unsigned int i;


/* USER CODE BEGIN (2) */
/* USER CODE END */

void main(void)
{
/* USER CODE BEGIN (3) */
	gioInit();
	 //gioPORTA->DIR  = 0 | (1 << 5);  /* Bit 5 */
	 gioSetDirection(gioPORTA,0x20);
     gioSetPort(gioPORTA,0x20);
	 gioSetBit(gioPORTA,0x20,1);

	while(1)
	{
		gioToggleBit(gioPORTA,0x20);
		for(i=0;i<100000;i++);
		for(i=0;i<100000;i++);
		for(i=0;i<100000;i++);
		for(i=0;i<100000;i++);
		for(i=0;i<100000;i++);
		for(i=0;i<100000;i++);
		for(i=0;i<100000;i++);
		for(i=0;i<100000;i++);
		for(i=0;i<100000;i++);
		for(i=0;i<100000;i++);
		for(i=0;i<100000;i++);
		for(i=0;i<100000;i++);
		for(i=0;i<100000;i++);
		for(i=0;i<100000;i++);
		for(i=0;i<100000;i++);
		for(i=0;i<100000;i++);
		for(i=0;i<100000;i++);
		for(i=0;i<100000;i++);


	}
/* USER CODE END */
}

/* USER CODE BEGIN (4) */
/* USER CODE END */

  • The parameter "bit" in the function gioToggleBit() is the bit number, 0-7. You want to use it like this:

    		gioToggleBit(gioPORTA,5);
    
  • I see you did try bit 5 directly on the direction reg.   So in case you also tried on the DOUT.. and it didn't work... 

    (but Bob *is* right about not passing 0x20 to the HalCoGen APIs... just thinking you may have tried other ways too..)

    If changing the 0x20 to 5 doesn't work I would suggest this:


    1) execute past gioInit() in CCS then halt.   (So put a breakpoint on the line the follows and run to that breakpoint).

    2) Open the registers view, and search for GIOA.

    3) look at the GIOA registers.   You've got a direction register, data out, data in, data set, data clear and some others...

    4) poke the values into the GIO registers (just directly double click and edit them in CCS's debugger).
      when you hit enter, CCS will write to the register for you.  Make sure to type 0x to start with though for hex numbers...


    5) observe how the hardware behaves.   Make sure you can make the pin go high and low as you are directly manning the controls.

    IF THE PIN DOESNT RESPOND then check the pinmux,  if the  GIO port isn't the first function listed on the pin name then you have to go to the pinmux to change it so that the GIO port has control over the pin in question.

    There is a pinmux tab in HalCoGen.


    6) once you are comfortable w. how the hardware should work then you will be well equipped to step through the APIs and see where things go wrong.