[En-Nut-Discussion] (no subject)

Michael Baverso mbaverso at elcontech.com
Sun Dec 8 00:33:27 CET 2002


For what it is worth.

I was having difficulty with baud rate selection.The only way I could get it to work was to change the type for baud_rate_select in th UARTDCB and then modify UartAvrSetSpeed(allows for rates slower than 4800):

static int UartAvrSetSpeed(UARTDCB *dcb, u_long baud, u_char devnum)
{
    
    /*
     * Refined calculation provided by Robert Hildebrand.
     */
    dcb->dcb_baudSelect = (u_short)(((((2 * NutGetCpuClock()) / (baud * 16L)) + 1) / 2) - 1);
    

#ifdef UBRR1L
    if(devnum)
        UBRR1L = dcb->dcb_baudSelect;
    else
#endif
 //outp(dcb->dcb_baudSelect, UBRR);
 
        outp((u_char)(dcb->dcb_baudSelect), UBRR0L);
        UBRR0H = (u_char)(dcb->dcb_baudSelect >> 8);
  
 
    return 0;
}

Anyway I am a newbie, so if something looks wrong with this please let me know.

Regards,

Mike B.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.egnite.de/pipermail/en-nut-discussion/attachments/20021207/ba15d13d/attachment.html>


More information about the En-Nut-Discussion mailing list