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.

RTOS/AM3359: SYS BIOS LED BLINK

Part Number: AM3359
Other Parts Discussed in Thread: SYSBIOS

Tool/software: TI-RTOS

Hi,

I am new to sys/bios. I am trying blink LED by creating a task.I used a gpioLEDBlink project in the starterware and a mutitask project in the resource explorer about SYS/BIOS, combined and created a project. I am not able to blink the LED. I too did the same what have been mentioned in the below link

https://e2e.ti.com/support/embedded/tirtos/f/355/t/443187

Please help me to resolve it

  • Hi Anjana,

    Does your project give you any errors? Have you confirmed that your Task(s) are running?

    Thanks,
    Gerardo
  • Hi Gerardo,

    Below is the code that we tried,

    #include <xdc/std.h>

    #include <xdc/cfg/global.h>

    #include <xdc/runtime/Error.h>

    #include <xdc/runtime/System.h>

    #include <ti/sysbios/BIOS.h>

    #include <ti/sysbios/knl/Clock.h>

    #include <ti/sysbios/knl/Task.h>

    #include <soc_AM335x.h>

    #include <evmAM335x.h>

    #include <gpio_v2.h> 

    #define GPIO_INSTANCE_PIN_NUMBER (23u)

     

    Void clk0Fxn(UArg arg0);

    Void clk1Fxn(UArg arg0);

     

    /*

    * ======== taskFxn ========

    */

    Void taskFxn(UArg a0, UArg a1)

    {

    System_printf("enter taskFxn()\n");

    Task_sleep(10);

    System_printf("exit taskFxn()\n");

    // System_flush(); /* force SysMin output to console */

    }

    /*

    * ======== main ========

    */

    Int main()

    {

    GPIO1ModuleClkConfig();

    /* Selecting GPIO1[23] pin for use. */

    GPIO1Pin23PinMuxSetup();

    /* Enabling the GPIO module. */

    GPIOModuleEnable(SOC_GPIO_1_REGS);

    /* Resetting the GPIO module. */

    GPIOModuleReset(SOC_GPIO_1_REGS);

    GPIODirModeSet(SOC_GPIO_1_REGS,

    GPIO_INSTANCE_PIN_NUMBER,

    GPIO_DIR_OUTPUT); 

    Task_Handle task;

    Error_Block eb;

    Clock_Handle clk1, clk2;

    Clock_Params clkParams;

    System_printf("enter main()\n");

    Clock_Params_init(&clkParams);

    Error_init(&eb);

    //--------------------

    //--------------------- 

    clkParams.period = 5;

    clkParams.startFlag = TRUE;

    clk1 = Clock_create(clk0Fxn, 5, &clkParams, NULL); /* clk1 – add */

    if (clk1 == NULL) {

    System_printf("Task_create() failed!\n");

    BIOS_exit(0);

    }

    task = Task_create(taskFxn, NULL, &eb);

    if (task == NULL) {

    System_printf("Task_create() failed!\n");

    BIOS_exit(0);

    }

     

    clkParams.period = 10;

    clkParams.startFlag = TRUE;

     

    clk2 = Clock_create(clk1Fxn, 11, &clkParams, NULL);

    if (clk2 == NULL) {

    System_printf("Task_create() failed!\n");

    BIOS_exit(0);

    }

    Clock_start(clk1); /* add */

    Clock_start(clk2);

     

     

    System_printf("Use Some Time...\n"); /* add */

    // System_flush(); /* add */

     

     

    UInt32 time; /* add */

    time = Clock_getTicks(); /* add */

     

     

    BIOS_start(); /* does not return */

    return(0);

    }

     

    void IdleLoop(void)

    {

         {

     

    GPIOPinWrite(SOC_GPIO_1_REGS,

    GPIO_INSTANCE_PIN_NUMBER,

    GPIO_PIN_HIGH);

     

    GPIOPinWrite(SOC_GPIO_1_REGS,

    GPIO_INSTANCE_PIN_NUMBER,

    GPIO_PIN_LOW);

     }

        }

    Void clk0Fxn(UArg arg0)

    {

    UInt32 time;

    time = Clock_getTicks();

    System_printf("System time in clk0Fxn = %lu\n", (ULong)time);

    }

     

    Void clk1Fxn(UArg arg0)

    {

    UInt32 time;

     

     

    time = Clock_getTicks();

    System_printf("System time in clk1Fxn = %lu\n", (ULong)time);

    System_printf("Calling BIOS_exit() from clk1Fxn\n");

    BIOS_exit(0);

    //System_flush();

    }

     

    We initially compiled a program using sys bios minimal TI template, without any GPIO starterware it worked fine.

    now when i combined GPIO starterware in sys bios minimal template i  am facing the following memory errors:

    Description Resource Path Location Type
    #10010 errors encountered during linking; "trial.out" not built trial    C/C++ Problem
    #10099-D program will not fit into available memory.  placement with alignment fails for section ".data" size 0x736 .  Available memory ranges: AM335x.cmd /trial line 33 C/C++ Problem
    #10099-D program will not fit into available memory.  run placement with alignment fails for section ".bss" size 0x4128 .  Available memory ranges: AM335x.cmd /trial line 30 C/C++ Problem
    #10099-D program will not fit into available memory.  run placement with alignment fails for section ".stack" size 0x2000 .  Available memory ranges: AM335x.cmd /trial line 29 C/C++ Problem
    #10264 DDR3 memory range overlaps existing memory range DDR0 linker.cmd /trial/Release/configPkg line 36 C/C++ Problem
    #10264 OCMC_SRAM memory range overlaps existing memory range L3OCMC0 linker.cmd /trial/Release/configPkg line 35 C/C++ Problem
    #10264 SRAM_HI memory range overlaps existing memory range SRAM linker.cmd /trial/Release/configPkg line 34 C/C++ Problem
    gmake: *** [trial.out] Error 1 trial    C/C++ Problem
    gmake: Target 'all' not remade because of errors. trial    C/C++ Problem

     

     

     

     

  • Hi Anjana,

    It looks a problem with your .cmd file, it looks like there's two of them and one of them may be overlapping the other. If you intended to have two of them you need to modify them so they don't overlap. If you only intend to have one of them then you need to disable the other one, you can do that by right clicking on it in you project and selecting Exclude from Build. You would probaby want to keep the one that was setup for SYS/BIOS.

    Thanks,
    Gerardo
  • Hi Gerardo,

    Thanks, its resolved.

    I am currently trying to a UART program, its as below:

    #include "uart_irda_cir.h"

    #include "soc_AM335x.h"

    #include "evmAM335x.h"

    #include "hw_types.h"

    #include <hw_uart_irda_cir.h>

    /******************************************************************************

    ** INTERNAL MACRO DEFINITIONS

    ******************************************************************************/

    #define UART_CONSOLE_BASE (SOC_UART_0_REGS)

    #define BAUD_RATE_115200 (115200)

    #define UART_MODULE_INPUT_CLK (48000000)

    /******************************************************************************

    ** INTERNAL FUNCTION DECLARATIONS

    ******************************************************************************/

    static void UARTStdioInitExpClk(unsigned int baudRate,

    unsigned int rxTrigLevel,

    unsigned int txTrigLevel);

    static void UartFIFOConfigure(unsigned int txTrigLevel,

    unsigned int rxTrigLevel);

    static void UartBaudRateSet(unsigned int baudRate);

    void UARTConsolePutc(unsigned char data);

    unsigned char UARTConsoleGetc(void);

    void UARTConsoleInit(void);

    /******************************************************************************

    ** FUNCTION DEFINITIONS

    ******************************************************************************/

    /**

    * \brief This function initializes the specified UART instance for use.

    * This does the following:

    * - Enables the FIFO and performs the FIFO settings\n

    * - Performs the Baud Rate settings\n

    * - Configures the Line Characteristics to 8-N-1 format\n

    *

    * \param baudRate The baud rate to be used for communication

    * \param rxTrigLevel The receiver FIFO trigger level

    * \param txTrigLevel The transmitter FIFO trigger level

    *

    * \return None

    *

    * \note By default, a granularity of 1 will be selected for transmitter

    * and receiver FIFO trigger levels.

    */

    static void UARTStdioInitExpClk(unsigned int baudRate,

    unsigned int rxTrigLevel,

    unsigned int txTrigLevel)

    {

    /* Performing a module reset. */

    UARTModuleReset(UART_CONSOLE_BASE);

    /* Performing FIFO configurations. */

    UartFIFOConfigure(txTrigLevel, rxTrigLevel);

    /* Performing Baud Rate settings. */

    UartBaudRateSet(baudRate);

    /* Switching to Configuration Mode B. */

    UARTRegConfigModeEnable(UART_CONSOLE_BASE, UART_REG_CONFIG_MODE_B);

    /* Programming the Line Characteristics. */

    UARTLineCharacConfig(UART_CONSOLE_BASE,

    (UART_FRAME_WORD_LENGTH_8 | UART_FRAME_NUM_STB_1),

    UART_PARITY_NONE);

    /* Disabling write access to Divisor Latches. */

    UARTDivisorLatchDisable(UART_CONSOLE_BASE);

    /* Disabling Break Control. */

    UARTBreakCtl(UART_CONSOLE_BASE, UART_BREAK_COND_DISABLE);

    /* Switching to UART16x operating mode. */

    UARTOperatingModeSelect(UART_CONSOLE_BASE, UART16x_OPER_MODE);

    }

    /*

    ** A wrapper function performing FIFO configurations.

    */

    static void UartFIFOConfigure(unsigned int txTrigLevel,

    unsigned int rxTrigLevel)

    {

    unsigned int fifoConfig = 0;

    /* Setting the TX and RX FIFO Trigger levels as 1. No DMA enabled. */

    fifoConfig = UART_FIFO_CONFIG(UART_TRIG_LVL_GRANULARITY_1,

    UART_TRIG_LVL_GRANULARITY_1,

    txTrigLevel,

    rxTrigLevel,

    1,

    1,

    UART_DMA_EN_PATH_SCR,

    UART_DMA_MODE_0_ENABLE);

    /* Configuring the FIFO settings. */

    UARTFIFOConfig(UART_CONSOLE_BASE, fifoConfig);

    }

    /*

    ** A wrapper function performing Baud Rate settings.

    */

    static void UartBaudRateSet(unsigned int baudRate)

    {

    unsigned int divisorValue = 0;

    /* Computing the Divisor Value. */

    divisorValue = UARTDivisorValCompute(UART_MODULE_INPUT_CLK,

    baudRate,

    UART16x_OPER_MODE,

    UART_MIR_OVERSAMPLING_RATE_42);

    /* Programming the Divisor Latches. */

    UARTDivisorLatchWrite(UART_CONSOLE_BASE, divisorValue);

    }

    /**

    * \brief This function initializes the specified UART instance for use.

    * This does the following:

    * - Enables the FIFO and performs the FIFO settings\n

    * - Transmitter and Recevier Threshold Levels are 1 byte each\n

    * - Baud Rate of 115200 bits per second(bps)\n

    * - Configures the Line Characteristics to 8-N-1 format\n

    *

    * \param None

    *

    * \return None

    */

    void UARTConsoleInit(void)

    {

    /* Configuring the system clocks for UART0 instance. */

    UART0ModuleClkConfig();

    /* Performing the Pin Multiplexing for UART0 instance. */

    UARTPinMuxSetup(0);

    UARTStdioInitExpClk(BAUD_RATE_115200, 1, 1);

    }

    /**

    * \brief This function puts a character on the serial console.

    *

    * \param data The character to be put on the serial console

    *

    * \return None.

    */

    void UARTConsolePutc(unsigned char data)

    {

    UARTCharPut(UART_CONSOLE_BASE, data);

    }

    /**

    * \brief This function puts a character on the serial console.

    *

    * \param none

    *

    * \return Character as input from the console

    */

    unsigned char UARTConsoleGetc(void)

    {

    return ((unsigned char)UARTCharGet(UART_CONSOLE_BASE));

    }

    int main()

    {

    UARTStdioInitExpClk(BAUD_RATE_115200,UART_FCR_TX_TRIG_LVL_56,UART_FCR_RX_TRIG_LVL_8);

    UartFIFOConfigure(UART_FCR_TX_TRIG_LVL_56,UART_FCR_RX_TRIG_LVL_8);

    UartBaudRateSet(BAUD_RATE_115200);

    UARTConsoleInit();

    UARTConsolePutc('S');

    }

    During debugging after the 1903th line i am getting an error as no source available as shown below.

    We have included all the necessary source and header files.

    Kindly help us to overcome with this issue.

  • Hi Anjana,

    That second program is not using TI-RTOS, so you would need to post that issue in a more appropriate forum such as the Starterware forum.

    Thanks,
    Gerardo