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.

TM4C123GH6PM: Bit Banding implementation

Part Number: TM4C123GH6PM
Other Parts Discussed in Thread: EK-TM4C123GXL

Hello, I want to implement bit banding to use it to set and clear GPIO pin but I found it take more instruction cycle than set way 

this is my implementation if there is some error tell me the best way to implement it 

volatile uint32_t* GPIO_GetBitBandIOAddress(unsigned int index)
{
PinConfig *pinDef = (PinConfig *) &GPIOTiva_config.pinConfigs[index];
const volatile uint32_t * baseAddress = gpioBaseAddresses[pinDef->port];

int pinNumber = getPinNumber(pinDef->pin);

// Add 0x3FC (data register offset) and clear the top byte to get the data address.
uint32_t dataAddress = 0x00FFFFFF & ((uint32_t)baseAddress + 0x3FC);

return (volatile uint32_t *)(0x42000000 + (32*dataAddress) + (4*pinNumber));
}

  • Hello Rehab,

    We have a bitbanding example in TivaWare to reference at: [Install Path]\TivaWare_C_Series-2.2.0.295\examples\boards\ek-tm4c123gxl\bitband

    See if referencing that provides you the information you need to get this to work at your expected performance levels. If not I'd need more background about your specific use case.

    Best Regards,

    Ralph Jacobi

  • Hello Ralph 

    I want to use bit banding to access the array to drive TLC (led driver) to fast response so if it possible or not 

  • Hello Rehab,

    I'm not deeply familiar with bit-banding but from what I've read up on, it sounds like when used with GPIO the result is more akin to bit-banging. So I am not sure that is going to drive a fast response on an LED driver. It looks like the inherent advantage to using bit-banding is that you get the write performed in a single atomic instruction that can't be interrupted, but that doesn't necessarily translate to an increase in performance.

    I found this article to be very helpful: https://atadiat.com/en/e-bit-banding-explained-a-feature-of-arm-cortex-m3/

    Best Regards,

    Ralph Jacobi