This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Can't write registers



Hello,

I am trying to write the clock manager register to turn on the PWM peripherals, but when I print out the value of the register before and after the write operation, I can see that it hasn't changed.  What am I doing wrong:

#define CM_PER_ADDR 0x44E00000
#define CM_PER_EPWMSS1_CLKCTRL 0xCC

// point to the register and write new value

cmper =  (uint32_t *) mmap(0, getpagesize(), PROT_READ|PROT_WRITE, MAP_SHARED, fd, CM_PER_ADDR);

printf("pwmss1 clk enable: %x\n", cmper[CM_PER_EPWMSS1_CLKCTRL]);
cmper[CM_PER_EPWMSS1_CLKCTRL] = 0xFFFF;
printf("pwmss1 clk enable: %x\n", cmper[CM_PER_EPWMSS1_CLKCTRL]);

  • I don't see a problem in the code submitted, thought I haven't tried getpagesize(). Here is an example on how to read the chip id that you can use

    int   mem_length=4096;

    char *ptr;
    // expect to see device id 0x0b944xxx
       ptr = mmap(NULL, mem_length, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0x44e10000);
       printf("\n\n\n");

       ptr = (char *)((unsigned int)ptr + (unsigned int)0x600);

       printf("Chip ID is 0x%8x should be 0x0b944xxx for AM335x \n\n",*(unsigned int*)ptr);