I work on a project which need some tasks carried out in the same time on
my Arduino Uno. And after few web researches, I found your project.
I try to make a simple example with a task which writes on the serial port.
But when I load the program, the arduino card sends me texts with strange
characters (example : GCÿ#ÿØ#ü¿cÿ¤äç¼ã£Dà [Ã'§'ä['¼¸C#$Dà)
Garbage on the serial port is almost always caused by a mismatch of speeds. The Arduino frequency of 16MHz is one of the worst cases, because it doesn't divide closely to any serial bit rate and there's always a small rate error.
I'm guessing that this case is caused because the CPU_CLOCK_HZ is not set to 16000000. This is done in the freeRTOS/include/FreeRTOSConfig.h file. Just adjust the comment appropriately, from my default below.
Hi,
I work on a project which need some tasks carried out in the same time on
my Arduino Uno. And after few web researches, I found your project.
I try to make a simple example with a task which writes on the serial port.
But when I load the program, the arduino card sends me texts with strange
characters (example : GCÿ#ÿØ#ü¿cÿ¤äç¼ã£Dà [Ã'§'ä['¼¸C#$Dà)
Have you an idea where comes from this bug ?
This is my code :
main.c :
include <stdlib.h>
include <stdbool.h>
include <string.h>
#include <avr io.h="">
/ Scheduler include files. /
include <FreeRTOS.h>
include <task.h>
include <queue.h>
include <semphr.h>
/ serial interface include file. /
include <lib_serial.h>
/ Create a handle for the serial port. /
xComPortHandle xSerialPort;
static void vHelloWorld(void*);
static void vHelloWorld(void*)
{
for( ;; )
{
xSerialPrintf("Hello World !\n");
vTaskDelay(1000);
}
}
/ Main program loop /
int16_t main(void) attribute((OS_main));
int16_t main(void)
{
xSerialPort = xSerialPortInitMinimal( 115200, portSERIAL_BUFFER,
portSERIAL_BUFFER);
avrSerialPrintf("Start of Main()\n");
xTaskCreate( vHelloWorld, ( signed portCHAR * ) "vHelloWorld", 50,
NULL,tskIDLE_PRIORITY+2, NULL );
vTaskStartScheduler();
}
--
Nicolas JAN
Nicolas,
thanks for writing.
Garbage on the serial port is almost always caused by a mismatch of speeds. The Arduino frequency of 16MHz is one of the worst cases, because it doesn't divide closely to any serial bit rate and there's always a small rate error.
I'm guessing that this case is caused because the CPU_CLOCK_HZ is not set to 16000000. This is done in the freeRTOS/include/FreeRTOSConfig.h file. Just adjust the comment appropriately, from my default below.
For a bit more background, see here.
http://feilipu.posterous.com/freetronics-2010-arduino-overclocking-and-rev
Good luck.