ts-7000
[Top] [All Lists]

[ts-7000] Troubles using RS485 in Hard real Time on TS7200 Board

To:
Subject: [ts-7000] Troubles using RS485 in Hard real Time on TS7200 Board
From: "Julien" <>
Date: Mon, 23 Apr 2007 16:13:34 -0000
I'm working on TS7200 Board and would like to use the COM2 in RS485 
mode in Hard Real Time. It's not possible to use controls such as 
ioctl() since it refers to linux fonctions. How can i do?


My idea is to build my own UART2 IRQ handler in user mode.


**********************************************************

So, I've created a thread used for my IRQ:

pthread_create(&RS485_thread_handler,attr,(void *(*)(void 
*))RS485_IRQ_Handler_Code,NULL); 

The code related to the RS485_IRQ_Handler_Code() Function is the 
following one:

void *RS485_IRQ_Handler_Code(void *arg)
{
        int ovr = 0;
        
        RS485_Task = 
rt_task_init_schmod(nam2num("RS485"),2,1000,0,SCHED_FIFO,0xFF);
        
        rt_allow_nonroot_hrt();
        mlockall(MCL_CURRENT | MCL_FUTURE);
        rt_make_hard_real_time();
        
        rt_request_irq_task(UART2_IRQ,RS485_Task,RT_IRQ_TASK,1);
        rt_startup_irq(UART2_IRQ);
        rt_enable_irq(UART2_IRQ);
        
        while(OK)
        {
                do {
                        ovr = rt_irq_wait(UART2_IRQ);
                        
                        if (ovr == RT_IRQ_TASK_ERR) 
                                break;  
                        rt_printk("IRQ!!");
                        rt_ack_irq(UART2_IRQ);
                        
                } while (ovr > 0);
                rt_pend_linux_irq(UART2_IRQ);
        }
        rt_release_irq_task(UART2_IRQ);
        
        rt_make_soft_real_time();
        rt_task_delete(Task_1);
        
        return 0;
} 


where UART2_IRQ is the VIC Interrupt Source for UART2 Interrupt: 54

I have the message, "<3>RTAI[hal]: rt_enable_irq(54) unbalanced from 
c60a1890" when running program. What does it means?


**********************************************************

In order to build my own IRQ handler, I attempt to modify some 
register's values such as UART2RXSts, UART2LinCtrlHigh, ...

It created a Segmentation Fault when program running! Are these 
registers locked? Should these registers be modified when system 
starting? And how can I modify them ??


**********************************************************

Did I choose the right way? How can I do differently?


Thank you for your help !!!


Julien




 
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/
 

<Prev in Thread] Current Thread [Next in Thread>
  • [ts-7000] Troubles using RS485 in Hard real Time on TS7200 Board, Julien <=
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU