SparkFun Forums 

Where electronics enthusiasts find answers.

Topics pertaining to the Arduino Core & software used with the Artemis module and Artemis development boards.
User avatar
By tomts
#238803
Hello -
I'm having trouble reading a lot of the Apollo3 registers. The following code reads the first register appropriately, but trying to read the second causes a hard fault. My casual observation is that registers below 0x50000000 can be read and trying to read those above causes a fault. This is on a Redboard Artemis Nano, but the same thing is happening with the Artemis Module. Does anyone know how to read all registers successfully?

void setup() {
Serial.begin(9600);
delay(3000);
Serial.println("begin serial");

Serial.print("Reg value: ");
Serial.println(GPIO->CFGE, HEX); //this address is 0x40010050
Serial.println(BLEIF->CLKCFG, HEX); //this address is 0x5000C200
}

void loop() {
}

The resulting output:

begin serial
Reg value: 0

++ MbedOS Fault Handler ++

FaultType: HardFault

Context:
R0: 10000F40
R1: 10006964
R2: 1
R3: 5000C000
R4: 10000F40
R5: 0
R6: 0
R7: 0
R8: 0
R9: 0
R10: 0
R11: 0
R12: 22739
SP : 100069D0
LR : 11153
PC : 1062A
xPSR : 61000000
PSP : 100069B0
MSP : 1005FF70
CPUID: 410FC241
HFSR : 40000000
MMFSR: 0
BFSR : 82
UFSR : 0
DFSR : 0
AFSR : 0
BFAR : 5000C200
Mode : Thread
Priv : Privileged
Stack: PSP

-- MbedOS Fault Handler --

++ MbedOS Error Info ++
Error Status: 0x80FF013D Code: 317 Module: 255
Error Message: Fault exception
Location: 0x1062A
Error Value: 0x10005980
Current Thread: main Id: 0x10003F20 Entry: 0x22589 StackSize: 0x1000 StackMem: 0x100059E0 SP: 0x100069D0
For more info, visit: https://mbed.com/s/error?error=0x80FF01 ... TEMIS_NANO
-- MbedOS Error Info --
By paulvha
#238806
I have done this many times but It is not as straightforward as you might think. To access some registers you need to use an Unlock key or use a different way to get the register.
All I can advise is to study the files that are part of the HAL (hardware Abstraction layer). If you run board library version 2.x.x. you can find these files in the board library at : SparkFun/hardware/apollo3/2.2.1/cores/mbed-os/targets/TARGET_Ambiq_Micro/TARGET_Apollo3/sdk/mcu/apollo3/hal
User avatar
By tomts
#238808
Hi Paul -
Thanks for your quick response. It looks like I've got some homework.

- Tom
 Topic permissions

You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum