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?
Solved! Go to Solution.
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!
-----------------------------------------------------------------------------------------------------------------------
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!
-----------------------------------------------------------------------------------------------------------------------