@Krzysztof-Skiba said in [Onion Omega2] Direct GPIO register access problem:

virt_addr = (mem_pointer + (mem_address & page_mask));

this is wrong...

mem_pointer is already pointing to mem_address...

your line basically makes mem_pointer point to address

0x10000600 + (0x10000600*4 & page_mask) = .... SEG FAULT....

To Fix: change

const uint32_t mem_size = 0x600;

to

const uint32_t mem_size = 0x600+0xAC;

const uint32_t mem_address = 0x10000600;

to

const uint32_t mem_address = 0x10000000;

and

virt_addr = (mem_pointer + (mem_address & page_mask));

to

virt_addr = (mem_pointer + (mem_size/sizeof(uint32_t) );