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.

On reconfiguring GPIO with TMS320F28035PN

Hi.

I am trying to create registers with just certain GPIO bits.

To do that I changed the DSP2803x_Gpio.h file. Here's an example that is working on my code:

struct GPADATDAC_BITS {
   Uint16 GPIO7:1;           // 0      GPIO7
   Uint16 GPIO8:1;           // 1      GPIO8
   Uint16 GPIO9:1;           // 2      GPIO9
   Uint16 GPIO12:1;          // 3      GPIO12
   Uint16 rsvd1:12;            // 15:12  reserved
};

union GPADATDAC_REG {
	Uint16                  all;
	struct   GPADATDAC_BITS bit;
};

I then add the following line to GPIO_DATA_REGS: 

union  GPADATDAC_REG    GPADAC;

This works perfectly well. I can set those bits as outputs, and I can see the output changing. However if instead of using some of the lower 16 bits I use some of the upper 16 bits of GPA, I can't ever see the output changing.

The change I make to the code above is:

struct GPADATDAC_BITS {
   Uint16 GPIO16:1;          // 4      GPIO16
   Uint16 GPIO17:1;          // 5      GPIO17
   Uint16 GPIO18:1;          // 6      GPIO18
   Uint16 GPIO25:1;          // 7      GPIO25
   Uint16 GPIO26:1;          // 8      GPIO26
   Uint16 GPIO27:1;          // 9      GPIO27
   Uint16 GPIO30:1;          // 10     GPIO30
   Uint16 GPIO31:1;          // 11     GPIO31
   Uint16 rsvd1:8;            // 15:12  reserved
};

In this case nothing works. I can't see the outputs changing. 

Note I did not include the code that sets the bits as outputs (by changing GPAMUX1/2 and GPADIR). I've tested those in hardware by using the original library and they work fine there...

Thanks in advance.

  • Ricardo,

    You cannot create a register by adding code to the header file.  Registers are hardware entities with fixed structure and memory location.  The header file simply provides users with the means to access register fields from their own code.  The best advice is not to modify the header files.

    It's hard to say why your first attempt appeared to work, but if you can post back attaching your modified GPIO header file I'll try to find it.  

    Regards,

    Richard