Home
Support

Knowledge Base

BSPs and drivers
Community resources
Product documentation
Questions?
Contact us

debugging a serial driver
 
________________________________________________________________________

Applicable Environment
________________________________________________________________________
  • Topic: Debugging serial driver
  • SDP: 6.4.1
  • Target: Any supported target
________________________________________________________________________

Solution / Recommendation
________________________________________________________________________

If no data over a serial line it is useful to check if the UART generates interrupts. This can be done by adding an incrementing counter into the ISR of the serial driver and printing the value on demand. "stty </dev/serx sane" calls the ser_stty() function in tto.c and is a good place to print the counter to the console or slogger.

Of course you can run the devc driver in the debugger as well.

tto.c

extern unsigned irq_count;
...
void
ser_stty(DEV_8250 *dev) {
unsigned lcr = 0;
const uintptr_t *port = dev->port;
unsigned value;

slogf( _SLOG_SETCODE(_SLOGC_TEST, 2), _SLOG_DEBUG1, "8250: irq count %d", irq_count);
printf( "irq count = %d\n", irq_count );

// Set Baud rate
value = (dev->tty.baud == 0) ? 0 : (dev->clk/(dev->tty.baud * dev->div));


intr.c

unsigned irq_count=0;
...
/*
* Serial interrupt handler
*/
const struct sigevent *
ser_intr(void *area, int id) {
struct dev_list *list = area;
int status = 0;
int something_happened;
unsigned char msr, lsr;
DEV_8250 *dev;
struct sigevent *event = NULL;
unsigned c;

irq_count++;

On the console type "stty /dev/ser1 sane" to print the count on the console and to slogger.


________________________________________________________________________
NOTE: This entry has been validated against the SDP version listed above. Use caution when considering this advice for any other SDP version. For supported releases, please reach out to QNX Technical Support if you have any questions/concerns.
________________________________________________________________________


Related Attachments
 None Found





Please contact us with your questions or concerns.