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.

Warm Reset programming example

Hi, 

I'm using the AM335x starterkit board, trying write a small piece of code for the warm reset functionality on this board. Have been trying to look around but couldn't find any some dummy example code to do the warm reset on the board. Not sure how to do this, using memory map to toggle the nRESETIN_OUT pin to trigger the warm reset, so that my application can detect and shutdown gracefully? So what are the option to do this? 

Any ideas or advice? 

Thanks.

Regards,

jenny

  • Hi Jenny,

    Jenny Liew said:
    Not sure how to do this, using memory map to toggle the nRESETIN_OUT pin to trigger the warm reset, so that my application can detect and shutdown gracefully?

    When nRESETIN_OUT pin is used as a reset source, the signal is generated from an external device. You cannot toggle this pin by software (there are no dedicated registers in PRCM). 

    Best Regards, 

    Yordan

  • Thanks Yordan, I was wrong. I am trying to detect the external interrupt from the switch when someone try to reboot the board.
    After googling and reading the Technical Reference Manual and also the drawing schematic, we noticed the NIM pin (which is the SW6 switch connected to it), probably will do the job.

    But I'm having issue and trying to figure out the what and how to detect the interrupt handling when someone press the SW6. Any idea or suggestion? Vaguely remember read some where on the internet that, someone said I can't access the interrupt routine from the userspace (and my dummy c++ exe too) directly and it's only able to detect from a driver. Is that correct?

    Can I access via the memory map address if my dummy c++ exe attempt to check the every 5 seconds on the pin?


    Many thanks.

    Regards,
    jenny
  • Hi Jenny,

    I don't think you could achieve that through a c++ api.

    Have a look at arch/arm/mach-omap2/prm33xx.c & arch/arm/mach-omap2/pm33xx.c

    Best Regards,
    Yordan
  • Thanks to the link.

    Before I start the proper driver for this external internal interrupt, i wrote a small HelloWorld driver. But I couldn't get it work, this is what i did:

    -Download ti-sdk-am335x-evm-08.00.00.00-Linux-x86-Install.bin from the Ti website, extract and run the setup.sh script. Then I run make install as said in the .

    -I wrote a small helloworld.c,

    /*  hello-1.c - The simplest kernel module.
    *   *
    *    *  Copyright (C) 2001 by Peter Jay Salzman
    *     *
    *      *  08/02/2006 - Updated by Rodrigo Rubira Branco <rodrigo@kernelhacking.com>
    *       */
    /* Kernel Programming */
    #define MODULE
    #define LINUX
    #define __KERNEL__
    
    #include <linux/module.h>  /* Needed by all modules */
    #include <linux/kernel.h>  /* Needed for KERN_ALERT */
    
    int init_module(void)
    {
      printk("<1>Hello world 1.\n");
    
      // A non 0 return means init_module failed; module can't be loaded.
          return 0;
    }
    
     //
    void cleanup_module(void)
    {
         printk(KERN_ALERT "Goodbye world 1.\n");
    }  
    
    MODULE_LICENSE("GPL");
    

    make file

    jenny@jenny-VirtualBox:/media/workspace$ cat helloModule/Makefile

    obj-m := helloworld.o

    KERNELDIR = /media/jenny/ti-sdk-am335x-evm-08.00.00.00/board-support/linux-3.14.26-g2489c02

    PWD = $(shell pwd)

    ARCH = arm

    CROSS_COMPILE=/media/jenny/ti-sdk-am335x-evm-08.00.00.00/linux-devkit/sysroots/i686-arago-linux/usr/bin/arm-linux-gnueabihf-

    all:

    $(MAKE) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KERNELDIR) M=$(PWD) modules

    ---------------------------------------------------------------------------------------

    - I manage to get the helloworld.ko file and copied into the board, But when i tried to load the module, it said:


    root@am335x-evm:/test# insmod helloworld.ko
    Error: could not insert module helloworld.ko: Invalid module format

    Did I miss out any steps or what I have done wrong?

    I did check the kernel release on the board,

    root@am335x-evm:/test# uname -r
    3.2.0

    and I check on the SDK kernel package, (jenny@jenny-VirtualBox:/media/workspace$ ll /media/jenny/ti-sdk-am335x-evm-08.00.00.00/board-support/linux-3.14.26-g2489c02/), looks like it's using version 3.14 instead of 3.20. Is this causing the error?

    Thanks.

    Regards,

    jenny

  • Hi Jenny,

    Correct.

    TI SDK8.0 uses newer version of the kernel 3.14.26, while you use the kernel from SDK6.0 (kernel 3.2)

    You can either upgrade to the newer SDK, or download the SDK6.0 sources: software-dl.ti.com/.../index_FDS.html

    By the way the latest TI SDK is SDK1.00.00.03: software-dl.ti.com/.../index_FDS.html (it uses kernel 3.14.43).

    Best Regards,
    Yordan