AnsweredAssumed Answered

Error Opening SPI Drivers w/ K60f120m

Question asked by Michael Marsocci on Feb 11, 2015
Latest reply on Feb 12, 2015 by Michael Marsocci

Hello,

 

I am trying to run the MQX 4.1 SPI demo project on my tower system using the k60f120m board.  I went into my user_config.h file and enabled SPI0,SPI1, and SPI2 by setting them to 1.  Also at the bottom of that file there are a few tabs (bsp, MQX, rtcs...user_config.h).  I went to the bsp tab and changed bsp_enable_spix from false to true for each of the SPI options.  The program compiles without error, but there is a warning message.  It was an error, but after my changes it is now a warning.  The flagged code is below.

 

#elif BSP_SPI_MEMORY_CHANNEL == 2

    #if ! BSPCFG_ENABLE_SPI2

        #error This application requires BSPCFG_ENABLE_SPI2 defined non-zero in user_config.h. Please recompile kernel with this option.

 

I also went into the k60f120m.h files and set where it defined the SPI connections to 1 from 0s. As shown below.

** Enable SPI2 device

** MGCT: <option type="bool"/>

*/

#ifndef BSPCFG_ENABLE_SPI2

    #define BSPCFG_ENABLE_SPI2

 

The program compiles and runs, but an error message saying Error opening SPI driver appears.  The code which throws the error message is below.

spifd = fopen (TEST_CHANNEL, NULL);

    if (NULL == spifd)

    {

        printf ("Error opening SPI driver!\n");

        _time_delay (200L);

        _task_block ();

    }

Outcomes