I am trying to do some pin multiplexing on my bare metal AM1808, but I can't seem to write the kick register? Or, more specifically, I seem to be unable to read back the values I tried to write.
Here is my code:
#define SYSCFG_BASE ((void*volatile)0x01C14000)
#define SYSCFG_KICK0R (*((unsigned int*volatile)(SYSCFG_BASE + 0x38)))
#define SYSCFG_KICK1R (*((unsigned int*volatile)(SYSCFG_BASE + 0x3C)))
#define KICK0_UNLOCK 0x83E70B13
#define KICK1_UNLOCK 0x95A4F10
#define KICK0_LOCK 0x0
#define KICK1_LOCK 0x0
static void
gpio_init (int diode)
{
int status = 0;
asm volatile (
"mrs %[ps],cpsr" : [ps]"=&r"(status)
);
printf("mode: 0x%x\n", status & 0x1F);
printf("kick0: 0x%x", SYSCFG_KICK0R);
SYSCFG_KICK0R = KICK0_UNLOCK;
printf(" -> 0x%x\n", SYSCFG_KICK0R);
printf("kick1: 0x%x", SYSCFG_KICK1R);
SYSCFG_KICK1R = KICK1_UNLOCK;
printf(" -> 0x%x\n", SYSCFG_KICK1R);
/* pinmux stuff */
SYSCFG_KICK0R = KICK0_LOCK;
SYSCFG_KICK1R = KICK1_LOCK;
}
which outputs:
mode: 0x13
kick0: 0x0 -> 0x0
kick1: 0x0 -> 0x0
Am I generally not able to read the kick registers although I am in supervisor mode? If so, how can I test if I unlocked the syscfg correctly?
UPDATE: As it turns out, the problem I was having was not related to the pin multiplexing, or the kick registers, but instead I had an error in the top level logic that used the correctly multiplexed GPIO pins. Sorry for the confusion.
0x4E840102
But I could not find anything in the manual if this references revision 2? – Andreas Grapentin