cancel
Showing results for 
Search instead for 
Did you mean: 

Bit-banding AHB2 in STM32L4. Is it possible?

serafim
Associate II
Posted on April 19, 2016 at 11:33

Bit-banding is a fine approach for manipulating bits, especially GPIO.

In STM32L476 GPIO are located in AHB2 address space.

However, AHB2 address space is located far beyond bit-band  region:

0x40000000   APB1, APB2, AHB1

0x42000000  Bit band region (for APB1, APB2, AHB1)

0x48000000  AHB2

Therefore my question is: where is location of AHB2 bit band region, if any?

Regards, Serafim

#bit-banding-stm32l4
4 REPLIES 4
Radosław
Senior
Posted on April 19, 2016 at 12:53

>> Bit-banding is a fine approach for manipulating bits, especially GPIO. Only for reading, Write is not save, use bitbang (BSS, BSSR registers).

Bit-band is only for AHB1 & APBx.

slimen
Senior
Posted on April 19, 2016 at 13:36

Hi,

Only AHB1 and all APB can be bitbanded. AHB2 not support bitband.

Bitband on STM32L4 can be used on GPIO.  

For GPIO pin control it is easy to use the BRR+BSRR registers.

You can check in programming Manual

http://www2.st.com/content/ccc/resource/technical/document/programming_manual/6c/3a/cb/e7/e4/ea/44/9b/DM00046982.pdf/files/DM00046982.pdf/jcr:content/translations/en.DM00046982.pdf

bitband region address : Section 2.2.5 Bit-banding

Regards

serafim
Associate II
Posted on April 19, 2016 at 14:15

Great thanks!

>> Bit-band is only for AHB1 & APBx.

I see.. But it is not written explicitly somewhere, is it?

BRR/BSRR is a good approach too.

However, using bit-band (in other series) is faster as it doesn't require condition checking.

Moreover, you do not need to have two parameters (Port, pin) for a single entitiy (pin), but only one.

Why are the bit-band writes not safe? I didn't see that in manuals.

Regards, Serafim

Radosław
Senior
Posted on April 19, 2016 at 15:30

>>But it is not written explicitly somewhere, is it?

Many info is writen not directly.  Check BitBand address range.

>>However, using bit-band (in other series) is faster as it doesn't require condition checking.

Not neccesary. BB access is longer (ldr with take more time).

>>Why are the bit-band writes not safe? I didn't see that in manuals.

 Read is save. BB is  still RMW access but done by BUS not core. So when periperal can change value of register....  Basicly ISR flag clearing by BB is very not save.