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/TMS320F28377S: CCS/TMS320F28377S

Part Number: TMS320F28377S

Tool/software: Code Composer Studio

I'm quite new to ccs and embedded systems. I'm trying to steer my way through the examples from the control suite

in the following example pertaining to gpio setup -

i couldn't quite understand the conditions used in the if operator . could you please help me out or if not guide me to few proper resources, where I could get a grasp of the topic.

i

gpioBaseAddr = (Uint32 *)&GpioCtrlRegs;
for (regOffset = 0; regOffset < sizeof(GpioCtrlRegs)/2; regOffset++)
{
//
//Hack to avoid enabling pull-ups on all pins. GPyPUD is offset
//0x0C in each register group of 0x40 words. Since this is a
//32-bit pointer, the addresses must be divided by 2.
//
if (regOffset % (0x40/2) != (0x0C/2))
{
gpioBaseAddr[regOffset] = 0x00000000;
}
}

  • The loop is intended to clear all GpioCtrlRegs except GPyPUD, so that if statement is there to make sure the GPyPUD registers get skipped.

    gpioBaseAddr sets up GpioCtrlRegs to be accessed like an array of 32-bit elements where regOffset is used to index into them. The actual register address offsets on the device are in terms of 16-bit words, which is why we divide 0x40 and 0x0C by 2 in the calculations. The (regOffset % (0x40/2)) part uses regOffset to calculate an offset relative to the start of the current register group (A, B, C, etc...). The (0x0C/2) part is the offset of the GPyPUD register within each group.

    Look up the GPIO registers in your technical reference manual to give a better picture of how the registers are arranged.

    Whitney

  • does the size(gpiocontrolregs) means 6(number of groups A,B,c etc)*12(number of control registers) ?
  • size(GpioCtrlRegs)/2 is the total number of 32-bit registers in the GpioCtrlRegs memory region. It should be 6 (number of groups) * 0x20 (number of 32-bit  registers dedicated to each port).

    Whitney