On Mon, 11 Sep 2006, Art wrote:
> It seems when I run my LCD program(isn't quite working yet but will
> compile). it disables the network port. the lights on the network
> port stop flashing when I execute the following line.
>
> 63: *LCD_Control = lucCmd|LCD_E;
The LCD interface only uses 3 of the bits in that byte. One of the other
bits controls the power to the ethernet controller (bit 0x02).
Technologics explicitly say in their documentation that you have to
do READ/MODIFY/WRITES to this port to prevent affecting other bits!
There is some example code for driving the LCD in ts7200io.c in my
lcdd code at
http://www.comp.leeds.ac.uk/jj/linux/lcdd.tgz
which shows how to preserve other bit settings!
Jim
>
> so far I think I have everything write with the LCD except for
> timmings. but I need to figure out why it turns off the Network. I
> am using a TS-7200 board. I use telnet and ftp to develope. So now
> to fix this trouble I have to reboot every time I run the LCD
> program.
>
>
> Is there a way to reset the network port after it has been turn off?
> from the serial port. I have tried "ifconfig eth0 restart". Below
> is the program I am using..
>
>
>
> #include<unistd.h>
> #include<sys/types.h>
> #include<sys/mman.h>
> #include<stdio.h>
> #include<fcntl.h>
> #include<string.h>
> #include<time.h>
>
> #define GPIOBASE 0x80840000
> //#define MODELBASE 0x22000000
> //#define TS7300 0x03
> #define PADR 0
> #define PADDR (0x10 / sizeof(unsigned int))
> #define PAMASK 0x7F
> #define PCDR (0x08 / sizeof(unsigned int))
> #define PCDDR (0x18 / sizeof(unsigned int))
> #define PCMASK 0x01
> #define PHDR (0x40 / sizeof(unsigned int))
> #define PHDDR (0x44 / sizeof(unsigned int))
>
> // These delay values are calibrated for the EP9301
> // CPU running at 166 Mhz, but should work also at 200 Mhz
> #define SETUP 15
> #define PULSE 36
> #define HOLD 22
>
> #define COUNTDOWN(x) asm volatile ( \
> "1:\n"\
> "subs %1, %1, #1;\n"\
> "bne 1b;\n"\
> : "=r" ((x)) : "r" ((x)) \
> );
>
> //volatile unsigned int *model_ptr;
> //unsigned int model;
> volatile unsigned int *gpio;
> /*
> volatile unsigned int *phdr;
> volatile unsigned int *phddr;
> volatile unsigned int *pcdr;
> volatile unsigned int *pcddr;
> volatile unsigned int *padr;
> volatile unsigned int *paddr;
> */
>
> void command(unsigned int);
> void writechars(unsigned char *);
> unsigned int lcdwait(void);
> void LCD_SETUP(void);
>
> volatile unsigned char *LCD_Control, *LCD_Control_DR, *LCD_Data,
> *LCD_Data_DR, *GPIOBDB;
>
> #define LCD_E 8
> #define LCD_RW 2
> #define LCD_RS 4
>
> struct timespec gTime;
>
> void lcdCommand(unsigned char lucCmd, unsigned char lucDataAddress,
> int liWait)
> {
> unsigned int lucCount;
> *LCD_Data = lucDataAddress;
> *LCD_Control = lucCmd|LCD_E;
> gTime.tv_sec = 0;
> gTime.tv_nsec = 6400;
> nanosleep(&gTime,NULL);
> *LCD_Control = lucCmd;
> gTime.tv_sec = 0;
> gTime.tv_nsec = 6400;
> nanosleep(&gTime,NULL);
> }
>
> void LCD_SETUP(void)
> {
> int fd;
> unsigned char *start;
> fd = open("/dev/mem", O_RDWR|O_SYNC);
> start = mmap(0, getpagesize(),
> PROT_READ|PROT_WRITE, MAP_SHARED, fd, GPIOBASE);
> gpio = (unsigned int *)(start);
> LCD_Control = (unsigned char *)(start + 0x40); // LCD_EN
> LCD_RS LCD_WR
> LCD_Control_DR = (unsigned char *)(start + 0x44); // LCD_EN
> LCD_RS LCD_WR Direction Register
> LCD_Data = (unsigned char *)(start + 0x0); // LCD Data Values
> LCD_Data_DR = (unsigned char *)(start + 0x10); // LCD Data
> Values Direction Register
> //*LCD_Control = 0x38;
> *LCD_Data_DR = 0xff;
> *LCD_Control_DR |= 0x38;
> close(fd);
> gTime.tv_sec = 0;
> gTime.tv_nsec = 20000;
> nanosleep(&gTime,NULL);
> lcdCommand(0,16+32,41);
> gTime.tv_sec = 0;
> gTime.tv_nsec = 4100;
> nanosleep(&gTime,NULL);
> lcdCommand(0,16+32,1);
> gTime.tv_sec = 0;
> gTime.tv_nsec = 100;
> nanosleep(&gTime,NULL);
> lcdCommand(0,16+32,0);
> lcdCommand(0,0x38,0); // Function Set
> lcdCommand(0,12,0); // Display On
> lcdCommand(0,1,0); // Clear Display
> lcdCommand(0,6,5); // increment
> }
>
> /* This program takes lines from stdin and prints them to the
> * 2 line LCD connected to the TS-7200 LCD header. e.g
> *
> * echo "hello world" | lcdmesg
> *
> * It may need to be tweaked for different size displays
> */
>
> int main(int argc, char **argv) {
> int i = 0;
>
> LCD_SETUP();
> //*LCD_Data_DR = 0xffffffff;
> //*LCD_Data_DR = 0x0;
> //*LCD_Control_DR |= 0x38;
> //*LCD_Data = 0;
> while (getchar()!=EOF)
> {
> // *LCD_Data = ~(*LCD_Data);
> // *LCD_Control = (*LCD_Control)^0x38;
> gTime.tv_sec = 0;
> gTime.tv_nsec = 20000;
> nanosleep(&gTime,NULL);
> //sleep(1);
> *LCD_Control ^= LCD_E;
> }
> *LCD_Data_DR = 0x0;
> *LCD_Control_DR &= ~0x38;
> return 0;
> }
>
>
>
>
>
>
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/ts-7000/join
(Yahoo! ID required)
<*> To change settings via email:
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|