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.

SATA problem with TIMER!

Other Parts Discussed in Thread: OMAPL138

Platform: OMAPL138

DSP side (DSP/BIOS): I used EDMA to transfer data via EMIFA, so i needed to init the TIMER by called "uint32_t USTIMER_init(void)",if not, the program would run in an error.

ARM side (Linux): However, after DSPside used this function--"used USTIMER_init", i can't dismount the SATA disk by called "system("umount /mnt/disk")". So,I can't save the data. I don't know haw to configer this TIMER module.


======================= USTIMER_init(void)====================================
//-----------------------------------------------------------------------------
// \brief initialize the microsecond timer.
//
// \param none.
//
// \return uint32_t
// ERR_NO_ERROR - everything is ok...us timer ready to use.
// ERR_INIT_FAIL - something happened during initialization.
//-----------------------------------------------------------------------------
uint32_t USTIMER_init(void)
{
// configure timer 0 for free run.
// 32-bit unchained mode, timer3:4 /12 prescaler.

// enable muxed pins as gpio outputs and disable all related interrupts.
// would need to also setup the pinmux register to select the gpio
// function of these pins in order to use as gpio.
TMR0->GPINT_GPEN = GPENO12 | GPENI12;
TMR0->GPDATA_GPDIR = GPDIRO12 | GPDIRI12;

// stop and reset timer.
TMR0->TGCR = 0x00000000;
TMR0->TCR = 0x00000000;

// disable interrupts and set emulation to free run.
TMR0->INTCTLSTAT = 0;
SETBIT(TMR0->EMUMGT, SOFT | FREE);

// config timer0 in 32-bit unchained mode.
// remove timer0 - 3:4 from reset.
SETBIT(TMR0->TGCR, PRESCALER(TIMER_DIV - 1) | TIMMODE_32BIT_UNCHAINED | TIM34RS );

// init timer0 - 1:2 period....use full range of counter.
TMR0->TIM34 = 0x00000000;
TMR0->PRD34 = 0xFFFFFFFF;

// start timer0 - 3:4.
SETBIT(TMR0->TCR, ENAMODE34_CONT);

// configure timer 1 for start/stop.
// 32-bit unchained mode, timer3:4 /12 prescaler.

// enable muxed pins as gpio outputs and disable all related interrupts.
// would need to also setup the pinmux register to select the gpio
// function of these pins in order to use as gpio.
TMR1->GPINT_GPEN = GPENO12 | GPENI12;
TMR1->GPDATA_GPDIR = GPDIRO12 | GPDIRI12;

// stop and reset timer.
TMR1->TGCR = 0x00000000;
TMR1->TCR = 0x00000000;

// disable interrupts and set emulation to free run.
TMR1->INTCTLSTAT = 0;
SETBIT(TMR1->EMUMGT, SOFT | FREE);

// config timer1 in 32-bit unchained mode.
SETBIT(TMR1->TGCR, PRESCALER(TIMER_DIV - 1) | TIMMODE_32BIT_UNCHAINED);

// init timer1 - 3:4 period....0 until someone calls delay().
TMR1->TIM34 = 0x00000000;
TMR1->PRD34 = 0x00000000;

return (ERR_NO_ERROR);
}

  • I came to know, you are using the BSL code of EVMC6748 for timer.
    This timer code should be working on EVM, Please double check if you are using custom board on your side.

    You can get the timer test code at OMAPL-138 CSL, as per the below wiki.
    http://processors.wiki.ti.com/index.php/QuickStartOMAPL1x_rCSL

  • Thanks for reply; I've tried many possibilities to set the TGCR register that referenced the rCSL examples, but it didn't work.

     I still confused about the TIMER moudle.

    What's the relationship between the SATA moudle be used in ARM side and the TIMER moudle in DSP side.

    Which timer and which mode should i set up into? timer 0 or timer 1? How should i do ?

    ///////////////////////////////////////////////////////////////////////////

    1/system("umount /mnt/disk");

    2/sync();

     Both of all don't work and the disk can't storage the data.

     

    thanks!