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.

How to set the gio pin high level Interrupt triggered by other external gio input.

Other Parts Discussed in Thread: HALCOGEN, TMS570LS3137

Hello,
What I want to do is using a gpio(GIOB0) pin as the external Interrupt
source,and other gpio pin(GIOB1) is triggered Interrupt by the GIOB0 high
level.And I tried many times to work out it, the problem is still there. I do
not know how to use the external input high level to trigger GIOB1, and the
setting of HAL.
I will be appreciate it if you can give me some answers,thanks.

  • Hi,


    Here are some Halcogen screenshot to show you the configuration.

    The GIO module has 2 interrupt lines connected to the VIM Module. GIO Int A and GIO Int B.

    In my example I will use GIO Int A (high priority because it is connected to the VIM request line #9 compare to GIO Int B connected to VIM request line 23.

    The other part to configure is the GIO module itself.

    So you want GIOB0 to be used as interrupt and GIOB1 used as GPIO pin controlling the interrupt.
    An external connection has to be done between GIOB0 and GIOB1.
    The Halcogen configuration will look like:

    GIOB0 is configured has interrupt capable, on rising edge, and will generate a High Priority Interrupt.
    GIOB1 is configured has Output. The default value driven on the pin will be Low.

    In your main code you will have to call the void gioInit(void) prior to do anything on the GIO module.

    Than you will have to use some of the GIO API to set HIGH and LOW the GIOB1 to generate your interrupt.

    NOTE. For this kind of test, it is possible to only use GIOB0.
    You can configure this pin as interrupt capable and at the same time configure it as OUTPUT.
    In your software, you can set this pin High to generate your rising edge and create your interrupt.

    Please let me know if I've answered your question.

  • Hi Jean-Marc,

        Thanks for your answers.

        I have followed the steps just like that, and It does not work. In my project, the GIOB1 as the Interrupt and connect the GIOB1 and GIOB0, and set the GIOB0 high level to trigger the GIOB1 into the interrupt function just like what you test. But the result what I get is not like it. after the GIOB0 set to high, the GIOB1 not get into the interrupt. If I set the GIOB1 at high level, and it works.

        I don't know the difference about the two methods. Are the direct to set to high and set by external pollingup have the different work methods in interrupt? I hope that you can give me some answers about it. If you can give me some details about the interrupt working methods, I will appreciate it very much.

    Best Regards

  • Ok, can you tell me which part number you are using?
    This could be related to the pin muxing options.

  • Hi,   

    The details about it is that,firstly,connecting the GIOB0 and GIOB1,and then running to poll high and low the GIOB0 in task1.Through to polling up the GIOB0 to make the GIOB1 into the interrupt.     But, it does not work.I want to ask whether it can be triggered to get into the interrupt by external polling high signal? or If I want use the external polling high signal to make it into the interrupt how I can do it?

        Thanks.

  • Hi,


    What it the part-number (device name) that you are using?

    In your last post, you are saying "to poll high and low the GIOB0 in task1" I'm not sure I understand what you are doing.
    Are you driving the pin High and Low using the DOUT or DSET/DCLR register or are you selecting the pin Pull-Up and Pull-Down?

    It will be easier if you can share your project (including Halcogen) so I can have a look.

  • C:\Users\Administrator\DesktopHi,

        The picture descript the project :

               softWare:

                        task1:{

                                       take semaphore(){

                                     Once the GIOB1 into the Interrupt, add 1 to the parameter of IntNum.(Count the Interrupt number) 

                                    }

                       }

                        Interrupt:{

                                       Enable the semaphore; 

                        }

                        task2:{

                                       while(1){

                                             Set the GIOB0 is 1;

                                              delay;

                                             Set the GIOB0 is 0;

                                       }

                        }

              HardWare:{

                       GIOB1 PIN connect to the GIOB0 PIN

              }

     

             Device is TMS570LS3137;

    Hopefully the descript of the project can light to you about it.

  • Thanks for these details, but without the Halcogen project, I can't tell if the GIOB0 and GIOB1 are correctly configured.
    Once again, without the full CCS project, I won't be able to tell you what is wrong.
  • Hi,

        Last few days, I can not give you the projects is owing to that I am in holiday.

        The CCS main codes about the projects is just like the follows:

    /* USER CODE BEGIN (0) */
    /*
    * Function: 外部I/O口作为中断源(GPIO中断)
    * Description: GIOB_0作为外部输出端口,不断的变换输出电平值,并与作为输入端口GIOB_1相连,
    * 当GIOB_1监测到高电平则进入中断程序,在中断程序中使能信号量,使中断次数加一并输出中断次数。
    *
    */
    /* USER CODE END */

    /* Include Files */

    #include "sys_common.h"

    /* USER CODE BEGIN (1) */
    #include "system.h"
    #include "FreeRTOS.h"
    #include "os_task.h"
    #include "os_semphr.h"
    #include "sci.h"
    #include "gio.h"
    #include "sys_vim.h"
    #include "uart_printf.h"
    /* USER CODE END */

    /** @fn void main(void)
    * @brief Application main function
    * @note This function is empty by default.
    *
    * This function is called after startup.
    * The user can use this function to implement the application.
    */

    /* USER CODE BEGIN (2) */
    xTaskHandle xGioTask1Handle;
    xTaskHandle xGioTask2Handle;
    SemaphoreHandle_t xSemaphore;

    uint16 INTcount = 0; //中断次数

    void wait(uint32 time)
    {
    while(time){time--;};
    }

    void vGIO_OutputTask(void *pArg) //task 2
    {
    gioSetBit(gioPORTB, 0, 0);
    while(1)
    {
    gioSetBit(gioPORTB, 0, 1);
    wait(0xFFFFFF);
    gioSetBit(gioPORTB, 0, 0);
    }
    }
    void vGIO_InputTask(void *pArg) //task 1
    {
    while (1)
    {
    if(xSemaphoreTake(xSemaphore,portMAX_DELAY)){
    INTcount ++;
    UartPrintf("The Current Interrupt CountNum is:%2d\r\n",INTcount);
    }
    }
    }
    /* USER CODE END */

    void main(void)
    {
    /* USER CODE BEGIN (3) */
    xSemaphore = xSemaphoreCreateBinary();

    /* Enable CPU Interrupt through CPSR */
    _enable_IRQ();

    sciInit();
    gioInit();

    //gioEnableNotification(gioPORTA,1);
    //gioSetDirection(gioPORTA, 0x02);
    //gioSetBit(gioPORTA,1,1);
    gioEnableNotification(gioPORTB,1);
    gioSetDirection(gioPORTB, 0x01);

    //gioSetBit(gioPORTB,1,1);
    //gioSetBit(gioPORTB,0,1);


    //Two tasks
    if (xTaskCreate(vGIO_InputTask,"GIO_InputTask", configMINIMAL_STACK_SIZE,NULL, 1, &xGioTask1Handle) != pdTRUE)
    {
    while(1);
    }

    if (xTaskCreate(vGIO_OutputTask,"GIO_OutputTask", configMINIMAL_STACK_SIZE,NULL, 1, &xGioTask2Handle) != pdTRUE)
    {
    while(1);
    }

    // Start Scheduler
    vTaskStartScheduler();

    /* Run forever */
    while(1);

    /* USER CODE END */
    }

    /* USER CODE BEGIN (4) */
    /* USER CODE END */

    The semaphore in task1 is triggered at the GIOB1 interrupt codes.

    I hope that you can give me some advice. I really eager for it.

  • Hi,


    Thanks for the code. I will check it and will be back to you.
    It will be great if you can share the Halcogen configuration files so I can check that there is nothing wrong in your device initialization. (.dil and .hcg)

  • Hi,

    I did modify your code and make it working.

    void vGIO_OutputTask(void *pArg) //task 2
    {
     gioSetBit(gioPORTB, 0, 0);
     while(1)
     {
      gioSetBit(gioPORTB, 0, gioGetBit(gioPORTB, 0) ^ 1);   // Toggle GIOB0
                                                            // This will generate a rising edge every 1 second
      vTaskDelay(500);                                      // Task will sleep for 500ms
     }
    }

    void vGIO_InputTask(void *pArg) //task 1
    {
     while (1)
     {
      if(xSemaphoreTake(xSemaphore,portMAX_DELAY))          // If semaphore is available, take it
      {                                                     // Otherwise the task will go to sleep
       INTcount ++;
      }
     }
    }

    In notification.c

    /* USER CODE BEGIN (0) */
    #include "FreeRTOS.h"
    #include "os_semphr.h"
    extern SemaphoreHandle_t xSemaphore;
    /* USER CODE END */

    /* USER CODE BEGIN (8) */
    /* USER CODE END */
    #pragma WEAK(gioNotification)
    void gioNotification(gioPORT_t *port, uint32 bit)
    {
    /*  enter user code between the USER CODE BEGIN and USER CODE END. */
    /* USER CODE BEGIN (19) */
        xSemaphoreGive(xSemaphore);
    /* USER CODE END */
    }

    On the board, I have GIOB0 and GIOB1 connected.

    vGIO_OutputTask will toggle GIOB0 every 500ms creating a rising edge on GIOB1 every second.

    Instead of using your wait loop (what is the point, you are using an RTOS) I'm using vTaskDelay(500);
    This will force the vGIO_OutputTask in sleep mode, allowing other task to run.

    Please have a try and let me know.