K64 UART buffer extend to 1KBytes

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

K64 UART buffer extend to 1KBytes

767 Views
isaotakashima
Contributor IV

We want to extend UART buffer up to 1KBytes.

We understand that we can extend UART buffer size by add the following code into the user_config.h.

#define BSPCFG_SCI1_QUEUE_SIZE  1024

But we find out the following comment in the twrk64f120m.h.

/*

** TTYB and ITTYB buffer size

** MGCT: <option type="number" min="0" max="256"/>

*/

We checked source code, but we cannot find out a reason that why maximum size of UART buffer is 256 bytes.

Here is my questions.

1. Can we extend UART buffer to 1,24 bytes?

2. If no, please explain that why we cannot extend UART buffer to 1,024 bytes.

Please reply as soon as possible.

Best regards,

Takakshima

Tags (3)
0 Kudos
2 Replies

439 Views
DavidS
NXP Employee
NXP Employee

Hi Takashima,

There really is no limit other than available SRAM.

I tested with the TWR-K64F120M using a 1024 buffer modified in the twrk64f120m.h as follows:

#ifndef BSPCFG_SCI5_QUEUE_SIZE

    #define BSPCFG_SCI5_QUEUE_SIZE             1024 //DES was 64

#endif

I also setup to use interrupt mode for my UART5 (ittyf).

My simple test was (NOTE I did modify the BSP serl_int.c code) as follows to return number of characters in the queue:

_mqx_int _io_serial_int_ioctl

   (

      /* [IN] the handle returned from _fopen */

      FILE_DEVICE_STRUCT_PTR fd_ptr,

      /* [IN] the ioctl command */

      _mqx_uint              cmd,

      /* [IN] the ioctl parameters */

      void                  *param_ptr

   )

{ /* Body */

   IO_DEVICE_STRUCT_PTR            io_dev_ptr;

   IO_SERIAL_INT_DEVICE_STRUCT_PTR int_io_dev_ptr;

   _mqx_uint                       result = MQX_OK;

   _mqx_uint_ptr                   uparam_ptr = (_mqx_uint_ptr)param_ptr;

   io_dev_ptr     = fd_ptr->DEV_PTR;

   int_io_dev_ptr = (void *)io_dev_ptr->DRIVER_INIT_PTR;

   switch (cmd) {

      case IO_IOCTL_CHAR_AVAIL:

         if ( _CHARQ_SIZE(int_io_dev_ptr->IN_QUEUE) ) {

//             *((bool *)param_ptr) = TRUE; //DES??? why not return _CHARQ_SIZE ???

             *((_mqx_int *)param_ptr) = _CHARQ_SIZE(int_io_dev_ptr->IN_QUEUE); //DES??? why not return _CHARQ_SIZE ???

         } else {

           *((bool *)param_ptr) = FALSE;

         } /* Endif */

      break;

Used the MQX hello example and modified hello.c as follows:

void hello_task

    (

        uint32_t initial_data

    )

{

    (void)initial_data; /* disable 'unused variable' warning */

    int io_param; //DES added

    int inchar; //DES added

    int rc; //DES added

    printf("Hello World\n");

#if 1 //DES 1=test, 0=default code

    for (;;)

    {

           rc = _io_ioctl(stdin,IO_IOCTL_CHAR_AVAIL,&io_param);

           while(io_param) //DES was                if(io_param)

           {

              inchar = fgetc(stdin);

             fputc(inchar, stdout);

             io_param--;

           }

           _time_delay(5000); //DES block for 5 seconds (5000msec)...give time to fill UART Rx queue

         

    }

#endif

    _task_block();

}

Regards,

David

0 Kudos

439 Views
jonny
Contributor I

Hi,

Is this still the case that the max buffer size can be increased over the stated maximum (mqx 4.1.1 with K60)?

I have one set to 512 in user config and its red with "Given value is larger than define maximum for this parameter (256).

Also is there a way for me to tell if the buffers are being filled?

Thanks

Jon

0 Kudos