send hex data by uart

I am using the lpcxxpresso 1769, I need to create a task that runs every 10 seconds automatically and to transmit a series of numbers in hexadecimal format:unsigned portCHAR pcCall[ 36 ]={0xbf, 0xff, 0x00, 0x1F, 0x43, 0x41, 0x4C, 0x4C, 0x20, 0x30, 0x30, 0x3A, 0x30, 0x37, 0x3A, 0x38, 0x30, 0x3A, 0x39, 0x62, 0x3A, 0x30, 0x38, 0x3A, 0x31, 0x62, 0x20, 0x31, 0x30, 0x30, 0x31, 0x20, 0x48, 0x44, 0x50, 0x0A};I try to modify the task vUARTCommandConsoleStart() on the sample FreeRTOS+IO; but only the first two bytes transmitted and aborts program execution, could someone tell me how I can create a task that runs independently and forward numbers in hexadecimal format?
send hex data by uart
How do you want the numbers to appear? As ascii or binary? If binary then you should be able to just send the start and length of pcCall to any suitable UART send function. If as ascii then with the 0x in front of each number of witout and with a comma between each number of without? In all cases you should be able to use sprintf() to format the string in a temporary buffer then send the start and length of the temporary buffer to any suitable UART send function.

send hex data by uart

could you five commercial suport? I need help for create a task for send hexadecimal characters, i tried but freertos not allow me to add a task,and tried to do it in different ways but only sends data in response to a command registered by FreeRTOS_CLIRegisterCommand.

send hex data by uart

Commercial support should not be necessary – all that is necessary is to understand what it is you are trying to do. If you went the commercial route they would just ask the same questions because they to would need to understand what you are trying to do. Is creating the task the problem? Or sending to the UART? Or the format of what you are trying to send to the UART? Regards.

send hex data by uart

Ok, I need to create using the next function, the next funcion usually works using a FreeRTOSCLIRegisterCommand(&xSampleAdc) action, but now I need to this begin from any task without using a command reception to start. is it possible? static portBASETYPE prvSampleAdcCommand( int8t *pcWriteBuffer, sizet xWriteBufferLen, const int8t *pcCommandString ) { PRIVILEGEDDATA static char pcString2[ 50 ] ;
char cont=0;
Resultado=0;
Resultado=RTC_GetTime(LPC_RTC,RTC_TIMETYPE_SECOND);
*pcWriteBuffer = ( signed char ) 0x00;

char *ptr = "inicio muestran";//agregado
strcat( ( char* ) pcWriteBuffer, ( char* ) ptr );//agregado

strcat( ( char * ) pcWriteBuffer, ( const char * ) "rn" );
sprintf(pcString2,"%dn", Resultado);
strcat( ( char * ) pcWriteBuffer, ( char * ) pcString2 );

getADCsample ( );

 for (cont=0;cont<200;cont++)
  {
    sprintf(pcString2,"%02xn",val[cont] );
    strcat( ( char * ) pcWriteBuffer, ( char * ) pcString2 );
  }
    strcat( ( char * ) pcWriteBuffer, ( const char * ) "rn" );
    char *ptr2 = "fin muestran";//agregado
    strcat( ( char* ) pcWriteBuffer, ( char* ) ptr2 );//agregado
pdFALSE. */ return pdFALSE; }

send hex data by uart

So the function you have posted (prvSampleAdcCommand()) generates a string that contains some data. You say in your post that generating the string works ok when prvSampleAdcCommnad() is called in response to somebody typing a command into the CLI. Now you want to call the same function from C code, rather than from the CLI? If so, then you can just make the function non-static and call it directly. Alternatively paste the same code into a new function and call that. In the function you posted I don’t see the string being sent to a UART. Do you have a UART send function you can use? If not you can get a suitable function from the LPCWare.com website as NXP provide drivers for this chip. Regards.

send hex data by uart

Thanks for your help. Now I am having problems when using strcat, the program aborts execution when i use it, and I dont now why? void vSendStringSerial ( void *pvParameters) { int8_t cRxedChar, cInputIndex = 0, *pcOutputString; static int8_t cInputString[ cmdMAX_INPUT_SIZE ]; portBASE_TYPE xReturned; int8_t *pcWriteBuffer=( signed char ) 0x00; char *pcString[ 50 ]; unsigned portSHORT val=100;
( void ) pvParameters;
pcOutputString = FreeRTOS_CLIGetOutputBuffer();
xConsoleUART = FreeRTOS_open( boardCOMMAND_CONSOLE_UART, ( uint32_t ) cmdPARAMTER_NOT_USED );
configASSERT( xConsoleUART );
xReturned = FreeRTOS_ioctl( xConsoleUART, ioctlUSE_ZERO_COPY_TX, cmdPARAMTER_NOT_USED );
configASSERT( xReturned );
xReturned = FreeRTOS_ioctl( xConsoleUART, ioctlUSE_CHARACTER_QUEUE_RX, ( void * ) cmdMAX_INPUT_SIZE );
configASSERT( xReturned );
xReturned = FreeRTOS_ioctl( xConsoleUART, ioctlSET_INTERRUPT_PRIORITY, ( void * ) ( configMIN_LIBRARY_INTERRUPT_PRIORITY - 1 ) );
configASSERT( xReturned );

sprintf( ( char * )pcString,"%xn", 0x64);
strcat( ( char * ) pcWriteBuffer, ( char * ) pcString );



if( FreeRTOS_ioctl( xConsoleUART, ioctlOBTAIN_WRITE_MUTEX, cmd50ms ) == pdPASS )
    {
        FreeRTOS_write( xConsoleUART, pcWriteBuffer, strlen( ( char * ) pcWriteBuffer ) );
    }
} attribute ((section(“.aftervectors”))) void HardFaultHandler(void) { __asm volatile ( ” tst lr, #4 n” ” ite eq n” ” mrseq r0, msp n” ” mrsne r0, psp n” ” ldr r1, [r0, #24] n” ” ldr r2, handleraddressconst n” ” bx r2 n” ” handleraddressconst: .word popregistersfromfaultstack n” ); }

send hex data by uart

Do you have stack overflow protection turned on? http://www.freertos.org/Stacks-and-stack-overflow-checking.html Are you running a recent version (7.6.0 or higher) with configASSERT() defined to give you the extra error checking included in those versions? http://www.freertos.org/a00110.html#configASSERT Regards.