FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [August 2013 Threads] LPC1768 Uart Baud Rate ProblemaPosted by Yuri Frehner on August 26, 2013 Hello, there is a question: I be using Free-RTos and have created a task to iniciate Uart on 115200 baud rate, but however all I do on configurations registers canĀ“t get right baud rate. For example, if I initiate Uart on 115200 I get 4800 on the terminal. I tried to implement the DLM and DLL starting a example code from hoan's blog, but nothing works on Free-Rtos, without Free-Rtos works normally. Can someone help me on this simple problem? Using Keil, FreeRTOS V6.1.0 and NPX LPC1768 microcontroller Uart Init Code: void Uart0_Init(uint32_t baudrate) { uint32_t uClk; uint32_t rate16 = 16 * baudrate; uint32_t dval, mval; uint32_t dl; uint32_t rem;
uClk = CLKPWR_GetPCLK (CLKPWR_PCLKSEL_UART0);
rem = uClk % rate16; dval = uClk % rate16;
if (dval > 0) { mval = rate16 / dval; dval = 1;
// in case mval still bigger then 4 bits // no adjustment require if (mval > 12) { dval = 0; } } dval &= 0xf; mval &= 0xf;
dl = uClk / (rate16 + rate16 *dval / mval);
LPC_PINCON->PINSEL0 |= (1 << 4); /* Pin P0.2 used as TXD0 (Com0) */ LPC_PINCON->PINSEL0 |= (1 << 6); /* Pin P0.3 used as RXD0 (Com0) */
LPC_UART0->LCR = 0x83; LPC_UART0->DLM = (((dl) >> 8) & 0xFF); LPC_UART0->DLL = ((dl) & 0xFF); /* Then reset DLAB bit */ LPC_UART0->LCR = 0x03; / */ LPC_UART0->FCR = 0x06; }
RE: LPC1768 Uart Baud Rate ProblemaPosted by Diptopal Basu on August 27, 2013 Your UART implementation generally falls outside of FreeRTOS. Probably where you might be getting stuck is initiating the UART in a task. Have you tried initialising UART in your 'main' before creating your tasks and then using the UART in your tasks? I have not tried out 115200 on my LPC1768 based board, I work on 38400. But ideally if your UART works , theres no reason it should not work on FreeRTOS. Have you tried using the CMSIS libraries, makes your life far easier? Have you verified if your tasks are running properly on FreeRTOS? Are you on the Keil simulator or on a real hardware?
RE: LPC1768 Uart Baud Rate ProblemaPosted by Yuri Frehner on August 27, 2013 Hello Diptopal, now I be testing your recommendations and soon as possible I will tell you the results. Thank you.
RE: LPC1768 Uart Baud Rate ProblemaPosted by Yuri Frehner on August 29, 2013 Finally I get my project running. I followed your tips and had my LPC1768 running properly. All I done was starting of zero adding each kernel library from my working start project and then putting the UART_Init function before the tasks. My Keil are simulating on a real hardware. Thank you very much.
RE: LPC1768 Uart Baud Rate ProblemaPosted by Yuri Frehner on August 29, 2013 Finally I get my project running. I followed your tips and had my LPC1768 running properly. All I done was starting of zero adding each kernel library from my working start project and then putting the UART_Init function before the tasks. My Keil are simulating on a real hardware. Thank you very much.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|