Hello,
I am still very new to this board, but I am usually able to read and write registers using HWREG.
But here is my problem. I am trying to read the industrial inputs via Read_HVS(); that we can find in am335x_indcomm_utils.c file of the SDK. The program is crashing when it wants to set the FORCE bit of the MCSPI_CH(i)CONF register (i=0 spi1):
HWREG(baseAdd + MCSPI_CHCONF(chNum)) |= (MCSPI_CH0CONF_FORCE);
When the program crashes, this is the exit in the console:
[CortxA8]
Hwi handle: 0x0.
Hwi stack base: 0x800178c4.
Hwi stack size: 0x2000.
R0 = 0x481a0000 R8 = 0x00000001
R1 = 0x00000000 R9 = 0x8000f65c
R2 = 0x8000fe16 R10 = 0x481a0000
R3 = 0x00000003 R11 = 0x00000001
R4 = 0x80019a20 R12 = 0x481a0000
R5 = 0x8000fe0c SP(R13) = 0x800197f0
R6 = 0x80001718 LR(R14) = 0x80004e0c
R7 = 0x00000000 PC(R15) = 0x80002cf4
PSR = 0x6000019f
ti.sysbios.family.arm.exc.Exception: line 176: E_dataAbort: pc = 0x80002cf4, lr = 0x80004e0c.
xdc.runtime.Error.raise: terminating execution
On the ASM side, while debugging, it is always craching at the LDR instruction:
| McSPICSAssert:
80002ce8:| E1A0C201 MOV R12, R1, LSL #4
80002cec:| E08CC101 ADD R12, R12, R1, LSL #2
80002cf0:| E080C00C ADD R12, R0, R12
80002cf4:| E59C012C LDR R0, [R12, #300]
80002cf8:| E3800601 ORR R0, R0, #1048576
80002cfc:| E58C012C STR R0, [R12, #300]
280 | }
I don't know if it can be helpful, but once I executed the LDR instruction, the program jumps to that kind of ASM code:
80019c10: E59FF018 LDR PC, 0x80019C30
80019c14: E59FF018 LDR PC, 0x80019C34
80019c18: E59FF018 LDR PC, 0x80019C38
80019c1c: E59FF018 LDR PC, 0x80019C3C
80019c20: 80000000 ANDHI R0, R0, R0
80019c24: 8000CC10 ANDHI R12, R0, R0, LSL R12
80019c28: 8000CC10 ANDHI R12, R0, R0, LSL R12
Has anyone any idea on how to be able to write in this register[McSPI1(481A_0000) + MCSPI_CH0CONF(+12C)] avoiding that error ? It seems that the ARM cannot add 12Ch (300) to 481A0000h of register R0 or R12.
Thanks,
Paul