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.

AM623: M4F timer problem

Part Number: AM623
Other Parts Discussed in Thread: SYSCONFIG

Tool/software:

Hello! I'm still trying to use the basic functions of the MCU_TIMERs from the M4F remoteproc. I'm using MCU+SDK ver. 09_02_01_06. I'm generating a new sysconfig based on the original "empty" example, contained in the SDK itself. I activate only one timer in it and, in my main code, I add only one function to start the chosen timer. I run gmake via terminal and build the object, I can load the .out into the board via CCS without any problems, however, when I put it to run, it breaks in a specific part (more description below). Any idea what could be getting in my way?

MAIN CODE (EMPTY WITH 2 LINES MODIFICATION):

#include <stdlib.h>
#include "ti_drivers_config.h"
#include "ti_board_config.h"
#include "ti_drivers_open_close.h"
#include "ti_board_open_close.h"

#define MCU_DTIMER3_ADRESS       (0x4800000u)

void empty_main(void *args);

int main()
{
    int32_t status = SystemP_SUCCESS;

    System_init();
    Board_init();

    /* Open drivers */
    Drivers_open();
    /* Open flash and board drivers */
    status = Board_driversOpen();
    DebugP_assert(status==SystemP_SUCCESS);

    TimerP_start(MCU_DTIMER3_ADRESS);

    empty_main(NULL);

    /* Close board and flash drivers */
    Board_driversClose();
    /* Close drivers */
    Drivers_close();

    Board_deinit();
    System_deinit();

    return 0;
}

SYSCONFIG FILE:

/**
 * These arguments were used when this file was generated. They will be automatically applied on subsequent loads
 * via the GUI or CLI. Run CLI with '--help' for additional information on how to override these arguments.
 * @cliArgs --device "AM62x" --package "ALW" --part "Default" --context "m4fss0-0" --product "MCU_PLUS_SDK_AM62x@09.02.01"
 * @versions {"tool":"1.20.0+3587"}
 */

/**
 * Import the modules used in this configuration.
 */
const addr_translate  = scripting.addModule("/kernel/dpl/addr_translate", {}, false);
const addr_translate1 = addr_translate.addInstance();
const addr_translate2 = addr_translate.addInstance();
const addr_translate3 = addr_translate.addInstance();
const addr_translate4 = addr_translate.addInstance();
const clock           = scripting.addModule("/kernel/dpl/clock");
const debug_log       = scripting.addModule("/kernel/dpl/debug_log");
const mpu_armv7       = scripting.addModule("/kernel/dpl/mpu_armv7", {}, false);
const mpu_armv71      = mpu_armv7.addInstance();
const mpu_armv72      = mpu_armv7.addInstance();
const timer           = scripting.addModule("/kernel/dpl/timer", {}, false);
const timer1          = timer.addInstance();

/**
 * Write custom configuration values to the imported modules.
 */
addr_translate1.$name     = "CONFIG_ADDR_TRANSLATE_REGION0";
addr_translate1.localAddr = 0x80000000;

addr_translate2.$name      = "CONFIG_ADDR_TRANSLATE_REGION1";
addr_translate2.systemAddr = 0x20000000;
addr_translate2.localAddr  = 0xA0000000;

addr_translate3.$name      = "CONFIG_ADDR_TRANSLATE_REGION2";
addr_translate3.systemAddr = 0x40000000;
addr_translate3.localAddr  = 0xC0000000;

addr_translate4.$name      = "CONFIG_ADDR_TRANSLATE_REGION3";
addr_translate4.systemAddr = 0x60000000;
addr_translate4.localAddr  = 0x60000000;

debug_log.enableUartLog = true;
debug_log.uartLog.$name = "CONFIG_UART0";

mpu_armv71.$name        = "CONFIG_MPU_REGION0";
mpu_armv71.attributes   = "Device";
mpu_armv71.allowExecute = false;

mpu_armv72.$name = "CONFIG_MPU_REGION1";
mpu_armv72.size  = 18;

timer1.$name             = "MCU_DTIMER0";
timer1.MCU_TIMER.$assign = "MCU_DMTIMER0";

/**
 * Pinmux solution for unlocked pins/peripherals. This ensures that minor changes to the automatic solver in a future
 * version of the tool will not impact the pinmux you originally saw.  These lines can be completely deleted in order to
 * re-solve from scratch.
 */
debug_log.uartLog.MCU_UART.$suggestSolution     = "MCU_USART0";
debug_log.uartLog.MCU_UART.RXD.$suggestSolution = "MCU_UART0_RXD";
debug_log.uartLog.MCU_UART.TXD.$suggestSolution = "MCU_UART0_TXD";

PRINT OF THE ERROR ON CCS LOAD FIRMWARE:

VIDEO WITH THE PROBLEM IN REAL TIME:

youtu.be/H_XP9p6DK-I

  • Hi Rafael,

    Thanks for your question.

    Allow me sometime to go through your code.

    Regards,

    Vaibhav

  • Hi Rafael,

    Thank you for your patience.

    I really appreciate for such a clarified explanation of the problem along with a youtube video explaining the same.

    My initial suggestion would be to make sure you have the following included:

    Looking forward to your response.

    Regards,

    Vaibhav

  • Hello Rafael,

    This might be a problem with timer address access in M4F core.

    You need to convert the Timer SOC address to an M4F local address map.

    I have shared the example of Timer + PWM in another thread  and see how I am accessing the timer Module and similarly you need to do like that.

    Please confirm whether my understating is correct or not.

    Regards,

    Anil.

  • Hi!
    That was the problem, it helped me a lot. But I wanted to know, why exactly do I need to use address translation and not put the base physical address inside the timer functions?

    If I use, for example
    #define MCU_TIM0 (*(volatile uint32_t*)(0x480000))
    I won't be able to set the bits in a register with
    MCU_TIM0 |= 0xFF
    Unless I pass my 0x480000 to the address translation function?