SPI IO_IOCTL_SPI_CLEAR_STATS not working on K60 in MQX4.1

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

SPI IO_IOCTL_SPI_CLEAR_STATS not working on K60 in MQX4.1

跳至解决方案
901 次查看
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?

标记 (3)
0 项奖励
回复
1 解答
700 次查看
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 项奖励
回复
1 回复
701 次查看
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 项奖励
回复