Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




Loading

FreeRTOS+IO ioctlSET_SPEED problem on LPC1759

Posted by tronics03 on August 16, 2013
Hello,

I'm using the FreeRTOS+IO (v1.0.1) on LPC1759. In my project I use several UARTs which work on different baud rates.
I have modified the BSP from Demo provided on official web to work for now only with one UART (UART0) and everything works fine when the UART is opened with
boardDEFAULT_UART_BAUD
. (default baud is 9600).

When change the default baud (to 19200) and I try to change baudrate right after
FreeRTOS_open()
with
xReturned = FreeRTOS_ioctl( xUARTPort, ioctlSET_SPEED, (void *) 9600 );

the communication doesn't work anymore on any baud rate (19200 nor 9600).

Am I doing something wrong here?

xUARTPort = FreeRTOS_open( boardUART_0, ( uint32_t ) cmdPARAMTER_NOT_USED );
xReturned = FreeRTOS_ioctl( xUARTPort , ioctlSET_SPEED, (void *) 9600 );





RE: FreeRTOS+IO ioctlSET_SPEED problem on LPC1759

Posted by Richard on August 16, 2013
So 9600 works when it is the default, but does not work when it is not the default but gets set to 9600 using FreeRTOS_ioctl()?

The default baud rate is set up with the following code:
xUARTConfig.Baud_rate = boardDEFAULT_UART_BAUD;
xUARTConfig.Databits = UART_DATABIT_8;
xUARTConfig.Parity = UART_PARITY_NONE;
xUARTConfig.Stopbits = UART_STOPBIT_1;
UART_Init( pxUART, &xUARTConfig );



The baud rate is set up within ioctl() using the following code:
xUARTConfig.Baud_rate = ulValue;
xUARTConfig.Databits = UART_DATABIT_8;
xUARTConfig.Parity = UART_PARITY_NONE;
xUARTConfig.Stopbits = UART_STOPBIT_1;
UART_Init( pxUART, &xUARTConfig );


so provided ulValue is 9600 it would appear the code snippets were the same.

Is it possible that the 1759 does not allow the baud to be changed when the UART is active (the code was created on a 1768, which I would image would have the same UART IP as the 1759, but I don't know for sure).

Regards.

RE: FreeRTOS+IO ioctlSET_SPEED problem on LPC1759

Posted by tronics03 on August 16, 2013
Hello Richard,

Thank you for your fast reply.

Yes, as I was tracking the code from the ioctl() and open() finctions I came up to those code snippets. By setting the break pionts on them I checked that the value ulValue is set to 9600, but strange thing that happens after ioctl() is that the UART stops to respond.

I also suspect that "on-the-fly" baud change is the cause for this. Do you have any suggestion how to confirm this?
I have checked some older posts where you have mentioned that FreeRTOS_close() will not be supported. Is there some legal licencing in question if I implement something like this by my self?

The IPs should be the same for 1759 and 1768 (it's the same manual and there are not any exeptions in UART chapter). I will try my code on 1769 also to check this.

Best regards

RE: FreeRTOS+IO ioctlSET_SPEED problem on LPC1759

Posted by Richard on August 16, 2013
As you are using the code on an LPC17xx you are covered by the commercial license terms, so there is no problem with you implementing the functions yourself. Of course it would be nice if you shared the modifications in the FreeRTOS interactive site (http://interactive.freertos.org).

To make a quick test you can just add a few lines into the existing code to disable the UART, make the change, then enable it again. In fact, you could disable it manually by calling the UART driver code directly (not through FreeRTOS+IO) before calling the ioctl() function.

Let us know what you find.

Regards.

FreeRTOS+IO ioctlSET_SPEED problem on LPC1759

Posted by tronics03 on November 21, 2013

Dear Richard,

I have finally came back to this issue. The problem was that Tx was disabled after the UARTInit() call. The solution is to call the UARTTxCmd(). I have made this change in FreeRTOSUARTioctl() function, like this:

case ioctlSET_SPEED :

    	/* Set up the default UART configuration. */
    	xUARTConfig.Baud_rate = ulValue;
    	xUARTConfig.Databits = UART_DATABIT_8;
    	xUARTConfig.Parity = UART_PARITY_NONE;
    	xUARTConfig.Stopbits = UART_STOPBIT_1;
    	UART_Init( pxUART, &xUARTConfig );

    	/* Enable Tx. */
    	UART_TxCmd( pxUART, ENABLE );
    	break;

I havent tried this on 1769 as I promissed, but for 1759 this solves the problem.

Thanks again for your help, Best regards


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists