Skip to main content
LKuri.1
Associate II
December 31, 2020
Question

Can't update GPIOx_MODER register value in STM32H753.

  • December 31, 2020
  • 2 replies
  • 795 views

I work with STM32H753 through 3-rd side hardware (Algocraft WN-1 programmer) and have an access to the registers. I try to read/write GPIOJ pins. For this purpose I enabled GPIOJ clock by writing the AHB4 peripheral clock enable register (RCC_AHB4ENR)

// Write to AHB4 peripheral clock enable register (RCC_AHB4ENR) to enable GPIOJ 

#prog -o cmd -c write -t h580244e0 -l 4 --data h00000200 --mask h132807ff 

#prog -o cmd -c compare -t h580244e0 -l 4 --data h00000200 --mask h132807ff --timeout 6000

and want to define PJ6 pin as common output:

// Write to GPIO port mode register (GPIOJ_MODER) PJ6 - OUT, PJ7 - IN 

#prog -o cmd -c write -t h58022400 -l 4 --data h00001000 --mask hffffffff

but always read hffffffff value from this register.

What wrong?

This topic has been closed for replies.

2 replies

waclawek.jan
Super User
December 31, 2020

And can you change other GPIO registers, e.g. ODR? Can you change other GPIO's registers, e.g. GPIOA?

What does the --mask parameter supposed to do, exactly?

JW

LKuri.1
LKuri.1Author
Associate II
December 31, 2020

The mask selects significant bits.

The GPIOA MODER register also includes default data:  0xABFF FFFF.

Data in ODR registers identical to MODER registers.

// Write to AHB4 peripheral clock enable register (RCC_AHB4ENR) to enable GPIOJ , GPIOA

#prog -o cmd -c write -t h580244e0 -l 4 --data h00000201 --mask h132807ff 

// Compare the AHB4 peripheral clock enable register (RCC_AHB4ENR) content with expected value.

#prog -o cmd -c compare -t h580244e0 -l 4 --data h00000201 --mask h132807ff --timeout 6000

#data -o set -c out -t file -f \images\RCC_AHB4ENR.bin 

#prog -o cmd -c read -m ram -s h0 -t h580244e0 -l 4

// Write to GPIO port mode register (GPIOA_MODER) PA0 - out

#prog -o cmd -c write -t h58020000 -l 4 --data h00000001 --mask hffffffff

// Compare the GPIO port mode register (GPIOA_MODER) content with expected value.

////#prog -o cmd -c compare -t h58020000 -l 4 --data h00000001 --mask hffffffff --timeout 6000

#data -o set -c out -t file -f \images\GPIOA_MODER.bin 

#prog -o cmd -c read -m ram -s h0 -t h58020000 -l 4

// Write to GPIO port mode register (GPIOJ_MODER) PJ6 - OUT, PJ7 - IN 

#prog -o cmd -c write -t h58022400 -l 4 --data h00001000 --mask hffffffff

// Compare the GPIO port mode register (GPIOJ_MODER) content with expected value.

////#prog -o cmd -c compare -t h58022400 -l 4 --data h00001000 --mask hffffffff --timeout 6000

#data -o set -c out -t file -f \images\GPIOJ_MODER.bin 

#prog -o cmd -c read -m ram -s h0 -t h58022400 -l 4

// Write to GPIO port mode register (GPIOA_ODR) PA0 - out

#prog -o cmd -c write -t h58020014 -l 4 --data h0000fffe --mask h0000ffff

// Compare the GPIO port mode register (GPIOA_ODR) content with expected value.

////#prog -o cmd -c compare -t h58020014 -l 4 --data h0000fffe --mask h0000ffff --timeout 6000

#data -o set -c out -t file -f \images\GPIOA_ODR.bin 

#prog -o cmd -c read -m ram -s h0 -t h58020014 -l 4

// Write to GPIO port mode register (GPIOJ_ODR) PJ6 - OUT, PJ7 - IN 

#prog -o cmd -c write -t h58022414 -l 4 --data h0000ff7f --mask h0000ffff

// Compare the GPIO port mode register (GPIOJ_ODR) content with expected value.

////#prog -o cmd -c compare -t h58022414 -l 4 --data h0000ff7f --mask h0000ffff --timeout 6000

#data -o set -c out -t file -f \images\GPIOJ_ODR.bin 

#prog -o cmd -c read -m ram -s h0 -t h58022414 -l 4