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.

AM335x Starter Kit DS3232 I2C RTC

Hi,

I have an AM335x Starter kit which I have fitted an i2c DS3232 RTC with battery.
The reason we are using this is because we have Version 1.0 of the Arm chip, so the RTC does not work on battery and I did not know the TPS65910A3 had an RTC built in, but as this doesn't have the xtal and neither RTCs give the option to add a battery on this board we fitted the i2c board.

Now, I have modified the menuconfig and removed the internal RTC driver and added the DS3232, I have modified the board-am335xevm.c file to add the DS3232 to the i2c driver. I also added a .irq setting to the i2c_board_info which allows me to set the alarm. All this works fine and the board sets the system time from the RTC on startup and I can set the alarm using /sys/class/rtc/rtc0/wakealarm and the DS3232 interrupt triggers.

My problem is where to connect the interrupt signal to on the starter kit, I thought about using the external SPI interface connector as I am not using this for anything else, but I can't get it to work.

I can't disable the SPI in the menuconfig as this is being used by something else on board (MMC ?), I believe.

Any ideas of an easy connection point and what else I need to do in the kernel ?

Cheers.
  Wayne 

  • I suppose that by SPI you mean the Zigbee header, J11? This would be a good place to connect the wakeup interrupt, as all the signals are pinmuxed with GPIO0, which is on the wakeup domain. You will need to pinmux the corresponding pin to GPIO input and setup a GPIO interrupt.
  • Yes, that is exactly what I have tried to do but I must be missing something as I can't get it to wake up.

    These pins are ideal as well because they have pull up resistors on them and the DS3232 interrupt is Open Drain, active low.

    Thank you for your quick response.

    If anyone can shed some light on what needs changing in the kernel to get the interrupt to work I would be grateful.

     

  • Hi,
    I am still having problems with this. I am pretty sure I either don't know what I am doing or I have done something wrong and that it is a software problem.
    I am hoping someone can point me in the right direction as I can not find the info online.

    I am a bit of a novice when it comes to Linux Kernel software, but I am a seasoned embedded engineer.

    My problem is this. I have connected a DS3232 battery backed up RTC to the starter kit.
    I modified the menuconfig to add the DS3232 driver as a kernel driver (*) not a module.
    I modified the  board-am335xevm.c files to init the i2c driver for the RTC.
    I connected the ^int output from the DS3232 to the spi0_cs0.gpio0_5 pin of the zigbee header.
    I made other changes to this file and modified the rtc-ds3232.c file.

    The RTC is read during bootup and works,
    I can set the alarm using
    "echo 0 > /sys/class/rtc/rtc0/wakealarm"
    "echo +5 > /sys/class/rtc/rtc0/wakealarm"

    The DS3232 generates an interrupt OK.
    I can create a /sys/class/gpio/gpio0 export and I can read the input which changes according to the RTC output.

    I cannot get the wakeup to work.

    I believe it is because I need a platform driver struct for the DS3232 so I can call "device_set_wakeup_capable" but I do not know how to do this and I can not find the info.

    So please, if anyone can shed any light on this or a link to the correct place I should be asking the questing then thank you.

    Wayne


     

  • Just to let everyone know I have fixed this problem.

    I added IRQF_TRIGGER_FALLING to request_irq in rtc-ds3232.c
    and I added irq_set_irq_wake imediately after request_irq in the same file.