2008-10-22 15:27:57 LCD driver BF537
damien OLLIVE (UNITED STATES)
Message: 64066
I try to writting a driver to an TFT LCD.
I have a question about the PPI_CLK, I have read in the HRM that is an external CLK
but can i creat a clock and allocate this clock to PPI_CLK inside (and if it's possible how allocate this value).
or it's an external clock and i have to create it outsine the BF537 board, i can't allocate a value to this pin.
Thanks
QuoteReplyEditDelete
2008-10-23 00:23:58 Re: LCD driver BF537
Frank Van Hooft (CANADA)
Message: 64082
That's correct - the PPI clock is always an input. Even when you're outputting data, the PPI clock is an input. Figure 7-11 in the BF537-HRM shows an example of this.
So one way or another, you need to generate a clock and then (externally, on your circuit board) feed this clock into the PPI clock pin. If you want the BF537 to generate this clock, take a look at the timer pins. You can easily program one of those to output a divided-down version of the BF537's system clock.
QuoteReplyEditDelete
2008-10-23 10:48:25 Re: LCD driver BF537
damien OLLIVE (UNITED STATES)
Message: 64121
thanks frank
that's to be sure i can't do that internally.
QuoteReplyEditDelete
2008-10-24 09:43:46 Re: LCD driver BF537
damien OLLIVE (UNITED STATES)
Message: 64164
HY,
My LCD working well with an external PPICLK.
Now i want to make this CLK by a blackfin timer and take it in the P11 timer port to link it with a wirer to the PPI_CLK and the PIXEL_CLK (of the LCD).
I have configure the Timer 5 like that but that don't working
#define bfin_write_TIMER_PPICLK_CONFIG bfin_write_TIMER5_CONFIG
#define bfin_write_TIMER_PPICLK_WIDTH bfin_write_TIMER5_WIDTH
#define bfin_write_TIMER_PPICLK_PERIOD bfin_write_TIMER5_PERIOD
#define TIMDIS_PPICLK TIMDIS5
#define TIMEN_PPICLK TIMEN5
Timer config:
bfin_write_TIMER_PPICLK_CONFIG(PWM_OUT|PULSE_HI|PERIOD_CNT);
timer_period = get_sclk() / (100);
printk("SCLK %d\n",timer_period);
bfin_write_TIMER_PPICLK_WIDTH(timer_period);
bfin_write_TIMER_PPICLK_PERIOD(timer_period / 2);
SSYNC();
Port request:
bfin_write_PORT_MUX (P_TMR5);
printk("portmux\n");
regdata = bfin_read_PORTF_FER();
regdata |= PF4; //enable PPI_CLK
bfin_write_PORTF_FER(regdata); //TMR5 sur PF4
regdata = bfin_read_PORTFIO_DIR();
regdata |= PF4; //ppi_clock is input
bfin_write_PORTFIO_DIR(regdata);
I have this timer to make the sync of my LCD and they work
#define TIMERS {P_TMR0, P_TMR1, 0}
Timer config:
bfin_write_TIMER_DISABLE(TIMDIS_HS|TIMDIS_VS|TIMDIS_PPICLK);
SSYNC();
/* Vertical Synchro, timer 1 */
bfin_write_TIMER_VS_CONFIG(PWM_OUT|PERIOD_CNT|TIN_SEL|CLK_SEL);
bfin_write_TIMER_VS_WIDTH(500);
bfin_write_TIMER_VS_PERIOD(1668335); //59.94Hz pour une CLK à 100MHz
SSYNC();
/* Horizontal Synchro, timer 0 */
bfin_write_TIMER_HS_CONFIG(PWM_OUT|PERIOD_CNT|TIN_SEL|CLK_SEL);
bfin_write_TIMER_HS_WIDTH( 41 );
bfin_write_TIMER_HS_PERIOD(5834); //17.14kHz pour une CLK à 100MHz
SSYNC();
port request:
u16 tmr_req[] = TIMERS;
printk("portsrequest\n");
if (peripheral_request_list(tmr_req, DRIVER_NAME)) {
printk(KERN_ERR "Requesting Peripherals TMR faild\n");
return -EFAULT;
}
I don't understand what this function does, could you explain me?
I have this in portmux.h
#define P_TMR5 (P_DEFINED | P_IDENT(GPIO_PF4) | P_FUNCT(0))
#define P_TMR1 (P_DEFINED | P_IDENT(GPIO_PF8) | P_FUNCT(0))
#define P_TMR0 (P_DEFINED | P_IDENT(GPIO_PF9) | P_FUNCT(0))
Thanks
QuoteReplyEditDelete
2008-10-24 09:46:03 Re: LCD driver BF537
damien OLLIVE (UNITED STATES)
Message: 64165
HY,
My LCD works well with an external PPICLK.
Now i want to make this CLK by a blackfin timer and take it in the P11 timer port to link it with a wire to the PPI_CLK and the PIXEL_CLK (of the LCD).
I have configured the Timer 5 like that but that don't work
#define bfin_write_TIMER_PPICLK_CONFIG bfin_write_TIMER5_CONFIG
#define bfin_write_TIMER_PPICLK_WIDTH bfin_write_TIMER5_WIDTH
#define bfin_write_TIMER_PPICLK_PERIOD bfin_write_TIMER5_PERIOD
#define TIMDIS_PPICLK TIMDIS5
#define TIMEN_PPICLK TIMEN5
Timer config:
bfin_write_TIMER_PPICLK_CONFIG(PWM_OUT|PULSE_HI|PERIOD_CNT);
timer_period = get_sclk() / (100);
printk("SCLK %d\n",timer_period);
bfin_write_TIMER_PPICLK_WIDTH(timer_period);
bfin_write_TIMER_PPICLK_PERIOD(timer_period / 2);
SSYNC();
Port request:
bfin_write_PORT_MUX (P_TMR5);
printk("portmux\n");
regdata = bfin_read_PORTF_FER();
regdata |= PF4; //enable PPI_CLK
bfin_write_PORTF_FER(regdata); //TMR5 sur PF4
regdata = bfin_read_PORTFIO_DIR();
regdata |= PF4; //ppi_clock is input
bfin_write_PORTFIO_DIR(regdata);
I have this timer to make the sync of my LCD and they work
#define TIMERS {P_TMR0, P_TMR1, 0}
Timer config:
bfin_write_TIMER_DISABLE(TIMDIS_HS|TIMDIS_VS|TIMDIS_PPICLK);
SSYNC();
/* Vertical Synchro, timer 1 */
bfin_write_TIMER_VS_CONFIG(PWM_OUT|PERIOD_CNT|TIN_SEL|CLK_SEL);
bfin_write_TIMER_VS_WIDTH(500);
bfin_write_TIMER_VS_PERIOD(1668335); //59.94Hz pour une CLK à 100MHz
SSYNC();
/* Horizontal Synchro, timer 0 */
bfin_write_TIMER_HS_CONFIG(PWM_OUT|PERIOD_CNT|TIN_SEL|CLK_SEL);
bfin_write_TIMER_HS_WIDTH( 41 );
bfin_write_TIMER_HS_PERIOD(5834); //17.14kHz pour une CLK à 100MHz
SSYNC();
port request:
u16 tmr_req[] = TIMERS;
printk("portsrequest\n");
if (peripheral_request_list(tmr_req, DRIVER_NAME)) {
printk(KERN_ERR "Requesting Peripherals TMR faild\n");
return -EFAULT;
}
I don't understand what this function does, could you explain me?
I have this in portmux.h
#define P_TMR5 (P_DEFINED | P_IDENT(GPIO_PF4) | P_FUNCT(0))
#define P_TMR1 (P_DEFINED | P_IDENT(GPIO_PF8) | P_FUNCT(0))
#define P_TMR0 (P_DEFINED | P_IDENT(GPIO_PF9) | P_FUNCT(0))
Thanks
---
QuoteReplyEditDelete
2008-10-24 12:26:28 Re: LCD driver BF537
damien OLLIVE (UNITED STATES)
Message: 64171
i have use the function peripheral_request_list(tmr_req, DRIVER_NAME) for the PPICLK and that works fine
but Where can i find documentation about this function i want to know what that do please
thank you
QuoteReplyEditDelete
2008-10-24 12:37:51 Re: LCD driver BF537
Mike Frysinger (UNITED STATES)
Message: 64175
there is no documentation atm other than the source ... look at the portmux header
QuoteReplyEditDelete
2008-10-24 13:07:26 Re: LCD driver BF537
Frank Van Hooft (CANADA)
Message: 64176
Port_Mux is used to control the functionality of a handful of pins, timer5 being one of them. See Figure 14-9 in the BF537 HRM. You can use the bfin_write_PORT_MUX and bfin_read_PORT_MUX functions (in kernel space) to control it depending upon your needs. For example:
bfin_write_PORT_MUX ( bfin_read_PORT_MUX() & ~PGSE ); // clear PGSE bit in portmux register
Note that PORT_MUX is not the only thing you need to do to control a pin - all the other usual things (setting the pin to output, etc) also still apply. PORT_MUX is an extra requirement for certain pins.
QuoteReplyEditDelete
2008-10-24 13:11:11 Re: LCD driver BF537
Mike Frysinger (UNITED STATES)
Message: 64177
people should not touch the port muxing registers directly. that is why we have the peripheral framework.
QuoteReplyEditDelete
2008-10-24 15:09:18 Re: LCD driver BF537
damien OLLIVE (UNITED STATES)
Message: 64181
OK thanks for your respond.
QuoteReplyEditDelete
2009-01-05 15:24:43 timer BF537
damien OLLIVE (UNITED STATES)
Message: 67388
Hy,
I need help with the timer
I want to have a timer in the P11 TIMERS port.
i use 3 timers (0, 1 and 2) in my driver and i had a forth like that but that don't working:
#define TIMERS {P_TMR0, P_TMR1, P_TMR2, P_TMR3, 0}
#define bfin_write_TIMER_DECLK_CONFIG bfin_write_TIMER3_CONFIG
#define bfin_write_TIMER_DECLK_WIDTH bfin_write_TIMER3_WIDTH
#define bfin_write_TIMER_DECLK_PERIOD bfin_write_TIMER3_PERIOD
#define TIMDIS_DECLK TIMDIS3
#define TIMEN_DECLK TIMEN3
static void start_timers(void)
{
unsigned long flags;
printk("timerstart\n");
local_irq_save(flags);
bfin_write_TIMER_ENABLE(TIMEN3|TIMEN2|TIMEN0|TIMEN1);
SSYNC();
t_conf_done = 1;
local_irq_restore(flags);
}
static void config_timers(void)
{
/* Stop timers */
bfin_write_TIMER_DISABLE(TIMDIS_HS|TIMDIS_VS|TIMDIS_PPICLK|TIMDIS_DECLK);
SSYNC();
/* DE */
bfin_write_TIMER_DECLK_CONFIG(PWM_OUT|PERIOD_CNT|TIN_SEL);
bfin_write_TIMER_DECLK_WIDTH( 4 );
bfin_write_TIMER_DECLK_PERIOD(527); //kHz pour une CLK à 9.1MHz aulieu de 533
SSYNC();
}
static int request_ports(void)
{
u16 ppi_req[] = PPI0_16;
u16 tmr_req[] = TIMERS;
if (peripheral_request_list(ppi_req, DRIVER_NAME)) {
printk(KERN_ERR "Requesting Peripherals PPI faild\n");
return -EFAULT;
}
if (peripheral_request_list(tmr_req, DRIVER_NAME)) {
peripheral_free_list(ppi_req);
printk(KERN_ERR "Requesting Peripherals TMR faild\n");
return -EFAULT;
}
static void free_ports(void)
{
u16 ppi_req[] = PPI0_16;
u16 tmr_req[] = TIMERS;
peripheral_free_list(ppi_req);
peripheral_free_list(tmr_req);
}
How configure the port 11 to enable the timer?
The peripheral_request_list function is not enough?
If somebody have an exemple of a program with a timer on P11 that could help me.