out8 problem with a watchdog timer on QNX 6.3

Call tech support from Avantech to get to the bottom of this.

Advantech Support is limited to the distribuitors, they don’t accept direct queries.

Advantech has reported to the Spanish distibuitor that the watchdog feature IS working well on this board.

So now we must change the hardware, and use another board :frowning:

So, for anyone else interested in using Qnx with PCM5820 Advantech board: use another one please, at less from the point of view of the watchdog, this 2 components are not compatible.

Is this a “canned” board ? Have you added any other hardware ? Is there a chance that you have some other piece of hardware at the same IO address ? It could definately cause the symptoms you are seeing.

No, the board is not modified, and no other hardware is installed.

I have 2 boards (one for development, and the other for production use), and both present the same problem.

There is 2 modes for the watchdog, selected through a jumper. One resets the board, and the other launch IRQ 11.

I was testing the reset mode.

In order to see more clearly what happens, the Qnx staff told me to switch to the IRQ 11 mode, and get all the events on the image created with the instrumented kernel.

I checked clearly that:

  • the executive is looping at the good rate.
  • But my big surprise was to discover that the IRQ11 is not beeing launched.

Finally, I checked that running an image, with a little handler for IRQ11, the IRQ is never launched, while running the same executive from the system shell the behaviour is different: the IRQ11 takes about 10 to 20 second to happen (this exective enables the watchdog, and refresh it every 100ms, similar to the one presented on the thread).

So in fact, all this seems to be an hardware failure, except that has been so easy to doing work well the watchdog with another operating system…

I have done more tests, now using the watchdog IRQ 11 mode, instead of the reset mode.

What I have discovered is that my test software is not able to enable the watchdog (in this mode) when it is on a generated image (booting from flash). I have checked this with the programm “watchdog_demo_qnx_handler.c” (at the end of this post).

This same executive has another effect when launched from the shell of the qnx environment (without photon). The IRQ 11 event happen, but like the reset case, it happen when the watchdog is beeing refreshed. The only difference is that the RESET event took 1second to happen, and the IRQ takes about 15seconds.

So the behaviour is different, but in both cases erroneous.

Another test: I don’t stop to refresh the watchdog, I don’t print anything on the screen, I run the executive on the image with the instrumented kernel, and I capture the events with the IDE. The resulting log files are too long to attach to this post (I can send it by email if you want).

The conclusions are:

  • IRQ11 don’t happen (that would be right, but as the first test demonstrates, it is because the watchdog was not enabled).
  • The timeline activity demonstrates that the executive it is refreshing the watchdog at the good rate.

So, finally, I give up with the Advantech PCM-5820 board.

Julián

[code]
/* Para mmap_device_io() */
#include <stdint.h>
#include <sys/mman.h>

/* para out8 */
#include <hw/inout.h>

/* Para ThreadCtl /
/
Para InterruptAttach */
#include <sys/neutrino.h>

/* For errno */
#include <errno.h>

#include <stdio.h>

#define WATCHDOG_IO 0x443
#define WATCHDOG_IRQ 11

/* Variables /
static volatile int flag_interrupcion=0; /
Says that an interrupt happen */

/* Interrupt handler */
const struct sigevent *handler_watchdog(void *area, int id )
{
InterruptMask(WATCHDOG_IRQ, -1);
flag_interrupcion=1;
return NULL;
}

int main (int argc, char *argv)
{
uintptr_t resu;
int res;
struct sigevent ;
struct timespec tiempo_espera;
/
Handle para escritura en el puerto */
uintptr_t port_handle=NULL;
uint8_t r;
uint16_t r2;
int counter=0;

/* Obtener permiso de acceso a io*/
res=ThreadCtl(_NTO_TCTL_IO, 0);
if (res==-1)
{
printf(“NO PERMISSION\n”);
}

/* Enable the interrupt handler /
/
IRQ, handle, Zona de memoria, tamanio zona memoria, flags */
res=InterruptAttach(WATCHDOG_IRQ, handler_watchdog ,NULL, 0, 0);
if (res==-1)
{
printf(“Error setting the interrupt handler: errno=%d\n”, errno );
}

/* Obtener permiso de acceso a la zona y port handle*/

port_handle=mmap_device_io(1, WATCHDOG_IO);
if (port_handle==MAP_DEVICE_FAILED)
{
printf(“mmap failure\n”);
}

/* Wait 5s, in order to let the time to connect to the target via qconn */
tiempo_espera.tv_sec=5;
tiempo_espera.tv_nsec=0;
nanosleep( &tiempo_espera ,NULL);

r=in8(port_handle);
while (counter++<300)
{
out8(port_handle, 1);
tiempo_espera.tv_sec=0;
tiempo_espera.tv_nsec= 100000000 ; /* Nanosegundos 10-9 / / 0.1s */
nanosleep( &tiempo_espera ,NULL);
if (flag_interrupcion)
{
printf(“i”);
fflush(stdout);
}
printf(“o”);
fflush(stdout);
}
printf(“END\n”);
while (1)
{
if (flag_interrupcion)
{
printf(“i”);
fflush(stdout);
}
}
}[/code]

Finally, I have checked that the watchdog works perfectly with another model of Advantech (PCM-9371).

So, definitively, it’s a incompatility issue between QNX and PCM-5820.
Advantech support has been inexistent, and Qnx has not given any solution.