Hello,
There are two PCI boards installed in my computer,
rtlinux-2.0, one ICPDAS pioda4 analog output board,
and one ICPDAS pci1800 analog input board. However,
I observed funny things. The analog output function:
void rt_pioda4_aset( unsigned short int channel,
unsigned short int value ) /* 16bit number*/
{
rtl_no_interrupts( irqstate );
output = (value>>2)|(channel<<14); /*14bit DAC */
outb( (unsigned char)(output>>8), pioda4.base_io+DA_HI_REG );
outb( (unsigned char)(output), pioda4.base_io+DA_LO_REG );
outb( 0xff, pioda4.base_io+DA_SEL_REG );/* select DAC 0*/
rtl_restore_interrupts( irqstate );
}
is used in a demo thread which does:
pthread_t demo;
void *rt_demo_thread( void *t ) {
unsigned short int value = 0;
pthread_make_periodic_np( demo, gethrtime(), 100000 );
while(1) {
pthread_wait_np();
// rt_pci1800_aget( 0, &value );
rt_pioda4_aset( 0, value );
value += 0x1000;
}
}
What I get on the scope is basically a nice ramp, but if
I use the mouse (interrupts!) the voltage on the output
board drops sometimes to -10V.
The same is true if I get a value from the input board
before the output, with a sinus signal applied to the
input (commenting out the +=0x1000) with the functions:
int rt_pci1800_wait_while( unsigned char mask, unsigned int timeout )
{
hrtime_t starttime;
starttime = gethrtime();
while ( ( inb( pci1800.control_io+STATUS_REG ) & mask ) == 0 )
if ( (gethrtime() - starttime) > timeout )
return -ETIME;
return 0;
}
int rt_pci1800_aget( unsigned short int channel,
unsigned short int *value )
{
unsigned short int input;
if ( ( inb( pci1800.control_io+STATUS_REG ) & ADC_BUSY ) == 0 )
return -EBUSY;
outw( CLEAR_FIFO, pci1800.control_io+CONTROL_REG );
outw( RESET_FIFO, pci1800.control_io+CONTROL_REG );
outw( ADC_START, pci1800.control_io+SW_ADC_REG );
if ( rt_pci1800_wait_while( ADC_BUSY, ADC_TIMEOUT ) < 0 )
return -ETIME;
input = inw( pci1800.analog_io+AIO_DATA_REG ); it
*value = ( input << 4 ); /* 12bit->16bit*/
return 0;
}
Now, the output of the analog output board is disturbed
too, but this effect disappears if I outb everything
two times between no and restore interrupts.
Another strange effect is that the input board seems
to work for some seconds, but then the sinus read in
and output can be see on the scope, but then climbs
up to the highest value, because inw from the input
board only returns 0xfff. When I inserted a gethrtime
after the end of conversion, I got up to 60usec
conversion time instead of 3usec of the board
characteristic.
Are these problems due to real time linux (would be
surprising because it worked already with avantech
ISA boards) or to PCI bus timing effects. Any ideas?
peterw
--
Dr. Peter Wurmsdobler
CTM - Centre de Transfert des Microtechniques
39, av. de l'Observatoire, BP-1445, 25007 Besancon CEDEX 3
TELEPHONE: +33 3 81 47 70 20 TELECOPIE: +33 3 81 47 70 21
E-mail: [EMAIL PROTECTED]
Ceterum censeo MIRCOSOFTem esse delendam.
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
---
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/