Hi,
I saw a couple queries from the forums but I couldn't figure this behavior. I am using AM3505 and the hardware is very close to LogicPD AM3517 EVM. I am using WinCE 6.0 R3 12/2011 with BSP_WINCE_ARM_A8_01_02_00 core. Pretty much I got all the SD, NAND, SPI, UART, Ethernet and SDIO working very well. I was able to get GPT10 PWM output square wave when I use the low level hardware test codes without WinCE. However, I followed existing OALPerformanceTimerInit() from PLATFORM\COMMON\SRC\SOC\CONNON_TI_V1\CONNON_TI\OAL\OMAP_GTP_TIMER\PROFILER\
profiler.c. I saw no output from GPMC_nCS5/SYS_NDMAREQ2/GPT10_PWM_EVT/GPIO_56. My guess is there something wrong with my WinCE BSP setup. Please take a look and I appreciate your inputs:
Here is my low level test codes without WinCE/BSP:
#define PAD_CONFIG_BASE (0x48002000)
#define CONTROL_PADCONF_gpmc_ncs5 (PAD_CONFIG_BASE + 0x00B8)
#define TCLR 0x0024
#define TCRR 0x0028
#define TLDR 0x002C
#define TMAR 0x0038
#define SCPWM (0x00000040) // bit 7
#define AR (0x00000002) // bit 1
#define ST (0x00000001) // bit 0
void PWM10Setup(void)
{
const uint32_t TLDR_SETTING = 0xFFFFFFE0; // 32kHz clk, 1 ms tick
config_pad(CONTROL_PADCONF_gpmc_ncs5, MODE3, PUPD_DIS, INPUT_DIS);
OUT_REGL(GPTIMER10 + TCLR, 0x00000000); // turn off timer
CLRBIT_REGL(CM_CLKSEL_CORE, (1 << 6)); // do not use 26 Mhz system clock
OUT_REGL(GPTIMER10 + TLDR, TLDR_SETTING);
OUT_REGL(GPTIMER10 + TMAR, (TLDR_SETTING + 2));
OUT_REGL(GPTIMER10 + TCRR, TLDR_SETTING);
OUT_REGL(GPTIMER10 + TCLR, (0x0000181C | SCPWM | AR | ST));
}
My WinCE BSP codes:
----- PLATFORM\MYBSP\SRC\INC\bsp_padcfg.h
#define GPIO_PADS \
PAD_ENTRY(GPMC_nCS4, INPUT_ENABLED | PULL_RESISTOR_ENABLED | PULLUP_RESISTOR | MUXMODE(4)) /* GPIO_55 */ \
PAD_ENTRY(GPMC_nCS5, INPUT_DISABLED | PULL_RESISTOR_DISABLED | MUXMODE(3)) /* SW_OUT */ \
. . . . .
----- PLATFORM\MYBSP\SRC\BSP_COMMON\BSPCFG\bspcfg.c
OMAP_DEVICE BSPGetPwmGPTDevice()
{
return OMAP_DEVICE_GPTIMER10;
}
----- PLATFORM\COMMON\SRC\SOC\CONNON_TI_V1\CONNON_TI\OAL\OMAP_GTP_TIMER\PROFILER\profiler.c
#define GPTIMER_TCLR_SCPWM (1 << 7)
OMAP_GPTIMER_REGS *g_pPwmTimer = NULL;
const UINT32 TLDR_SETTING = 0xFFFFFFE0; // 32kHz clk, 1 ms tick
...
void OALPwmGpt10Init()
{
UINT32 deviceAddress;
OMAP_DEVICE pwmDevice = BSPGetPwmGPTDevice();
if (pwmDevice == OMAP_DEVICE_NONE)
{
return;
}
OALMSG(1, (L">>>> OALPwmGpt10Init device: %d\r\n", pwmDevice));
deviceAddress = GetAddressByDevice(pwmDevice);
OALMSG(1, (L">>>> device physical address: 0x%x\r\n", deviceAddress));
g_pPwmTimer = OALPAtoUA(deviceAddress);
OALMSG(1, (L">>>> device virtual address: 0x%x\r\n", g_pPwmTimer));
OALMSG(1, (L">>>> Soft reset GPT10 and wait until finished <<<<\r\n"));
// Soft reset GPTIMER and wait until finished
SETREG32(&g_pPwmTimer->TIOCP, SYSCONFIG_SOFTRESET);
while ((INREG32(&g_pPwmTimer->TISTAT) & GPTIMER_TISTAT_RESETDONE) == 0);
OALMSG(1, (L">>>> Turning off GPT10 <<<<\r\n"));
// Turn off timer. Tried with and without this with same result.
OUTREG32(&g_pPwmTimer->TCLR, 0);
// 32kHz source clock is already set in PlatformSetup()
//srcClock = BSPGetSysTimer32KClock(&clockFrequency);
//PrcmDeviceSetSourceClocks(pwmDevice,1,&srcClock);
OALMSG(1, (L">>>> Set the load register value <<<<\r\n"));
// Set the load register value.
OUTREG32(&g_pPwmTimer->TLDR, TLDR_SETTING);
OUTREG32(&g_pPwmTimer->TMAR, (TLDR_SETTING + 2));
OUTREG32(&g_pPwmTimer->TCRR, TLDR_SETTING);
// 0x0000181C | SCPWM | AR | ST
OUTREG32(&g_pPwmTimer->TCLR, GPTIMER_TCLR_PT |
GPTIMER_TCLR_TRG_OVERFLOWMATCH |
GPTIMER_TCLR_PTV_DIV_256 |
GPTIMER_TCLR_SCPWM |
GPTIMER_TCLR_AR |
GPTIMER_TCLR_ST);
// Start the timer. Also set for auto reload
SETREG32(&g_pPwmTimer->TCLR, GPTIMER_TCLR_ST);
while ((INREG32(&g_pPwmTimer->TWPS) & GPTIMER_TWPS_TCLR) != 0);
OALMSG(1, (L">>>> OALPwmGpt10Init done...\r\n"));
}
----- UART3 trace show GPT10 started but no PWM
>>>> OALPwmGpt10Init device: 5
>>>> device physical address: 0x48086000
>>>> device virtual address: 0xb6086000
>>>> EnableDeviceClocks
>>>> Soft reset GPT10 and wait until finished <<<<
>>>> Turning off GPT10 <<<<
>>>> Set the load register value <<<<
>>>> OALPwmGpt10Init done...