SPI IO_IOCTL_SPI_CLEAR_STATS not working on K60 in MQX4.1

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

SPI IO_IOCTL_SPI_CLEAR_STATS not working on K60 in MQX4.1

Jump to solution
641 Views
ARQuattr
Contributor IV

I was using the SPI example code with a Flash chip running on both an MCF52254 and K21 device, and they work fine.  For some reason when testing this on a K60 device, there is an error when calling the IO_IOCTL_SPI_CLEAR_STATS command.  This is the part of the code in the SPI example that gives the error.


  /* Clear statistics */
   printf ("Clearing statistics ... ");
   if (SPI_OK == ioctl (spifd, IO_IOCTL_SPI_CLEAR_STATS, NULL))
   {
      printf ("OK\n");
   } else {
      printf ("ERROR\n");
   }


I checked the result of that call and I get a value of 44 (dec).  I'm not sure what this error means.  I was expecting something like (DRIVER_ERROR_BASE | 0x0700 | 0x0n), or 0x0001070n.


Is there some reason I can't clear stats on this device?

Tags (3)
0 Kudos
Reply
1 Solution
440 Views
RadekS
NXP Employee
NXP Employee

It returns IO error code MQX_IO_OPERATION_NOT_AVAILABLE. This is defined in mqx.h file as (MQX_ERROR_BASE|0x2C) and this is equal to 44dec.

If you look at _io_spi_ioctl() function in spi.c file, you can see that this error is generated in case when BSPCFG_ENABLE_SPI_STATS = 0.

Please define BSPCFG_ENABLE_SPI_STATS as 1 if you will use SPI statistics for some reason.


Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
Reply
1 Reply
441 Views
RadekS
NXP Employee
NXP Employee

It returns IO error code MQX_IO_OPERATION_NOT_AVAILABLE. This is defined in mqx.h file as (MQX_ERROR_BASE|0x2C) and this is equal to 44dec.

If you look at _io_spi_ioctl() function in spi.c file, you can see that this error is generated in case when BSPCFG_ENABLE_SPI_STATS = 0.

Please define BSPCFG_ENABLE_SPI_STATS as 1 if you will use SPI statistics for some reason.


Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply