Hi everyone,
well… after 4 days of hard work, testing, asking questions in this forum (by the way, thanx Rick and Mario for all help), new implementations, new tests, changes on approachs and everything else, I finally found the problem.
In these days, I could learn much more about data acquisition, x86 architecture, 8254 timer, 8259 interrupt, QNX, ISRs, threads, etc… Something I’m sure every device driver developer knows, but for me, I only have the possibility to learn something when the problem occurs, as most of the people from Brazil, because here is “impossible” (strong word, I know, but is quite true) to learn about such specialized job as device drivers, robotics systems and intrumentation. I don’t even know anyone else who works with QNX and how did they learn about it. I’m pretty sure they learned like me… Using, testing and looking for solutions by yourself. Using this forum, asking question on qnx inn server, etc.
Well. I’ll describe all history. It is a big text with lots of english mistakes (sorry guys) but I think is a helpful information.
The work was to develop a system for instrumentation using a SBC computer and a PC-104 data acquisition board (da_board).
During the tests of timer programming for pacer trigger on the da_board, I use an osciloscope to see if the 8254 timer was programmed as I wanted. Initially, I put the osciloscope channel 1 on LPT port to see a signal generated by my ISR routine (one timer trigger - out8(PAR,0xFF), next one - out8(PAR, 0x00), and so on). This way, I could generate a square waveform with the frequency programmed (on 8254 timer) divided by 2.
Looking at osciloscope, this signal showed me too many variations, the osciloscope trigger could not be stable, the frequency had too many changes, etc.
I started to look for bugs on my IRQ thread. With RobKrten’s book at my desk , made some changes, tested again, etc. One interesting test was to see how the was the signal behavior under Photon and text mode.
Over Photon, the signal became more stable than on text mode. Not as stable as needed, but better. Strange…
I’ve decided to do some tests using different interrupts (IRQs 3, 4, 5, 6 and 7), but no changes at all.
I decided to go down a bit and try to see the Interrupt signal generated by timer. As the da_board have only one chip with everything integrated (PCM-3718 from advantech), I couldn’t get the signal directly from timer. Than, I choosed to get the signal on the PC-104, pin 25 (IRQ 3).
My surprise was to see the signal was unstable too . The thread was working exactly as the interrupt signal. At this point, as a software developer (kind of ), I though about hardware problems. But I wanted to be sure, so I posted the article on the forum. With help, I made all changes to make the thread bug-free (let’s say that) and to be sure that the problem was not on software.
I ask for help with my professor, and we started to test everything again. I’ve made changes, new programs, everything to see if the problem could be with software or not. Well… the problem still persists.
Searching the net for all specifications on da_board, SBC board, someone else who had a similar problem, I found a very interesting link about the SBC board (Gene-4310 from Aaeon). The manufacturer put this link information : "Gene-4310( Not Recommended for New Design) http://na.aaeon.com/3-1-0-esbc.php?mode=viewi&i_id=20. What ??
I started to look what they mean by this and again I couldn’t find any information.
This was interesting, because it opened my mind to a possibility of problem on the SBC.
I’ve decided to go down more and look for information on 8259 interrupt controler. With all in mind, I’ve developed a tiny DOS program to use the SBC timer (timer 0 - IRQ 0) and to generate the same signal (square waveform) on the LPT port.
It showed me the same problem again.
This was critical to me.
I’ve changed the SBC (now using a vsbc-6 from versalogic, this one have the ad system on board) and tried the DOS program again and… STABLE SIGNAL! GREAT! I’ve put the PC-104 (PCM-3718) da_board, plug my HDD with QNX with the full system, and run the entire system. STABLE! AAAAAAAHHH!!! :mrgreen:
I’ve almost made a new and nice detail on the wall with the old SBC !
After this, I learn some tips for intrumentation systems developers.
1 - be sure that your SBC is full functional. Begin with a small DOS program to program 8254 timer and 8259 interrupt controller, generate signals and see them stable on the osciloscope.
2 - be sure your data acquisition board is full functional. Make tests with function generators, use a program (MATLAB for instance) to plot the data and see if the signal generated is the same as the signal acquired, make a FFT and check the frequency.
3 - Start your system implementation.
This is a good way to be sure you’ll not loose days and days looking for a problem you can’t solve!
Once again, I’m sorry for such big post, and thanx a lot for all the people who helped me (Rick, Mario and other users).
I’m going to have a beer now.
See you,
Leandro Colen
P.S. Boards used :
Gene-4310 from Aaeon - http://na.aaeon.com/3-1-0-esbc.php?mode=viewi&i_id=20
PCM-3718 from Advantech - http://www.advantech.com/products/Model_Detail.asp?model_id=1-LFMMW&bu=
VSBC-6sr - from VersaLogic - http://www.versalogic.com/products/ds.asp?productID=75