Unable to read PRCI registers

Using the FE310-G002 device (id 0x20000913) what, if any, preliminary steps must be done before reading from an address such as 0x10018000? It seems like the core hangs or faults when attempting to do so. However, reading from address such as 0x10012040 shows normal operation as expected.

This {does not} hang anymore (typo, was 0x10018, it happens :frowning: )

`lui a0, 0x10008`
`lw a1, 0(a0)`

This works:

`lui a0, 0x10012`
`lw a1, 64(a0)`

Code is loaded into and runs from ram:
MEMORY { ram : ORIGIN=0x80000000, LENGTH=0x4000 }
.text : { *(.text*) } > ram
.rodata : { *(.rodata*) } > ram
.bss : { *(.bss*) } > ram

sp is set at 0x800040000 at beginning of the program.

2020-02-28 pds problem resolved, typo above

1 Like

Paul have you figured out if you can read and write to this register in C? Or do you have to call the asm() function and manually set the registers in assembly?

Hey, thanks @c0ntrarian so much for the reply :blush: yes, got the PRCI stuff working well from C.
Culprit was a simple typo: I put 0x10018000 instead of the correct PRCI base as 0x10008000. Oops. With exception of a few tiny omissions in the spi block, so far I find everything working pretty well.

I use nothing but vi and bash for all the work; and the openocd bitbang driver, which needs a little touch-up to solve some race conditions with non-ideal long wire development environments (in that case, best results are with long reset delays, very slow jtag rate, and load/run from ram 0x80000000)

1 Like