I am getting an error of "double free or corruption (fasttop): 0x085cf810" when I call the ~Spi() function. Is there something I am missing before calling the function or is there a better way to close the spi bus on the Edison Arduino board?
Any insight would be appreciated as I can't find any info on the issue.
Hi, thanks for your reply. The image is 1.7.2 and I'm using C++. I am calling the ~Spi() deconstructor when the error arises. The spi is being used to send data to a single MAX7219 led display driver. Any insight would be helpful.
Im sorry it has taken me so long to reply. I had been out of town this week.
I had tried to use the mraa_spi_stop() function directly with the same error result. In the mraa documentation the destructor ~Spi() calls the mraa_spi_stop() function, so it isnt any surprise. Both do stop the spi bus, however it throws the error and aborts which is strange.
What code are you using? We'd like to try and replicate this issue. Can you post the code and steps you followed so far so we can reproduce this issue?
I'm using the arduino board with pins 13, 11, 10 configured for SPI via the linux commands. The board is connected to a MAX7219 LED dispaly driver via the SPI pins. (exluding pin12 MISO).
This is the class which calls the functions (Note: OO method is commented out as I have tried both methods):
MAX7219Driver::s = new mraa::Spi(1);
MAX7219Driver::s = mraa_spi_init(1);
The main() processes data it receives from a hall sensor and, then writes data to the MAX7219, which all works the way it should. The problem occurs when a button is pressed which calls a function to send shut down command to the MAX7219 and, then exit the main() while(1) loop and call the SPI shutdown function, then exit program.
The program outputs the aforemetioned error and exits.