[libmaple] SDIO

Limited support for STM32F4 Discovery, Nucleo and custom F4 boards
victor_pv
Posts: 1599
Joined: Mon Apr 27, 2015 12:12 pm

Re: [libmaple] SDIO

Post by victor_pv » Thu Aug 03, 2017 3:42 am

acronis wrote:
Thu Aug 03, 2017 2:10 am
Hello victor_pv.

Saw Your message in the desire of porting FreeRTOS on STM32F4 microcontroller.
Do You have such plans? An example from the library works fine, but I failed to run my program with ETHERNET.
The compiler gave the error I wrote above.
Do you have the opportunity to understand and help me ?
Have you posted that error in a separate thread? this one seems to be dedicated to the SDIO only, so I don't want to hijack it, it will make it difficult for people to follow what's going on.
Please send me the link to the thread where you posted about that error.

victor_pv
Posts: 1599
Joined: Mon Apr 27, 2015 12:12 pm

Re: [libmaple] SDIO

Post by victor_pv » Thu Aug 03, 2017 3:44 am

stevestrong wrote:
Wed Aug 02, 2017 5:20 pm
No changes planned, it seems to work stable, but which does not mean that is bug-free :P
So you are good to go.
Steve, just compared the SDIO peripherals in the reference manual side by side between F1 and F4, they are idential to the letter except the bus they are connected to, and few cosmetic changes in some lines.

Base addresses are different, rest should be the same, so I will see if I can find a board in my pile with an sdcard and test it out.

If it is as expected, all that will change is the base address in the header file. If that's the case even if you make major changes to the code should still work in the F1.

acronis
Posts: 107
Joined: Thu Mar 02, 2017 12:32 pm

Re: [libmaple] SDIO

Post by acronis » Thu Aug 03, 2017 4:10 am

victor_pv wrote:
Thu Aug 03, 2017 3:42 am

Have you posted that error in a separate thread? this one seems to be dedicated to the SDIO only, so I don't want to hijack it, it will make it difficult for people to follow what's going on.
Please send me the link to the thread where you posted about that error.
http://www.stm32duino.com/viewtopic.php ... =60#p32263

victor_pv
Posts: 1599
Joined: Mon Apr 27, 2015 12:12 pm

Re: [libmaple] SDIO

Post by victor_pv » Thu Aug 03, 2017 4:54 pm

acronis wrote:
Thu Aug 03, 2017 4:10 am
victor_pv wrote:
Thu Aug 03, 2017 3:42 am

Have you posted that error in a separate thread? this one seems to be dedicated to the SDIO only, so I don't want to hijack it, it will make it difficult for people to follow what's going on.
Please send me the link to the thread where you posted about that error.
http://www.stm32duino.com/viewtopic.php ... =60#p32263
Can you post a link to the version of sdfat that you are using? or better yet, can you post here the line that the error is referencing to?

victor_pv
Posts: 1599
Joined: Mon Apr 27, 2015 12:12 pm

Re: [libmaple] SDIO

Post by victor_pv » Thu Aug 03, 2017 5:00 pm

acronis wrote:
Wed Aug 02, 2017 8:37 am
Hello.

If you #include <MapleFreeRTOS900.h> SD card (SDIO) the error appears.

Code: Select all



#include <Arduino.h>
#include <SPI.h>
#include "SdioF4.h"


SdFatSdio sd;
File file;



In file included from C:\Users\Admin\Documents\Arduino\libraries\SdFat\src/BlockDriver.h:27:0,

                 from C:\Users\Admin\Documents\Arduino\libraries\SdFat\src/SdFat.h:27,

                 from C:\Users\Admin\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\SDIO/SdioF4.h:5,

                 from C:\Users\Admin\Desktop\STM32F4\RFIDRTOS\RFIDRTOS.ino:12:

C:\Users\Admin\Documents\Arduino\libraries\SdFat\src/SdCard/SdSpiCard.h:264:51: error: macro "writeData" passed 2 arguments, but takes just 1
without FreeRTOS everything works.
Tell me how to fix this error
The error is not related to FreeRTOS.

For some reason you are including the SDIO files, which have an implementation of writeData taking 1 parameter only:
https://github.com/stevstrong/Arduino_S ... 4.cpp#L751

But also including sdspicard.h, which is for using the SPI port instead of the SDIO, and takes 2 parameters:
https://github.com/greiman/SdFat/blob/m ... ard.h#L264

Please check where sdspicard.h is included from.
to be clear, an SDcard can work on either SPI more or SDIO mode.
Depending which mode you want to use, you need to include the SPI implementation, or the SDIO implementation of SDFat.
I can't imagine why you get that error only if you include FreeRTOS, FreeRTOS does not include any part of SdFat.

acronis
Posts: 107
Joined: Thu Mar 02, 2017 12:32 pm

Re: [libmaple] SDIO

Post by acronis » Fri Aug 04, 2017 2:42 am

Hm....
Today I tried again to make a clean project for example rtos_blink.
Connect two libraries immediately you receive this error.
If you leave any one library, then everything is fine.

Library https://github.com/stevstrong/Adafruit_ ... 6bit_STM32

But together the two give an error.

Use cost STM32F407VET6 BLACK and https://github.com/stevstrong/Arduino_STM32/

Code: Select all

#include <MapleFreeRTOS900.h>

#include <Adafruit_TFTLCD_16bit_STM32.h>    // https://github.com/stevstrong/Adafruit_TFTLCD_16bit_STM32                       
#include <SPI.h>
#include "SdioF4.h"                                           //http://stm32duino.com/viewtopic.php?f=39&t=2215


static void vLEDFlashTask(void *pvParameters) {
    for (;;) {
        vTaskDelay(1000);
        digitalWrite(BOARD_LED_PIN, HIGH);
        vTaskDelay(50);
        digitalWrite(BOARD_LED_PIN, LOW);
    }
}

void setup() {
    // initialize the digital pin as an output:
    pinMode(BOARD_LED_PIN, OUTPUT);

    xTaskCreate(vLEDFlashTask,
                "Task1",
                configMINIMAL_STACK_SIZE,
                NULL,
                tskIDLE_PRIORITY + 2,
                NULL);
    vTaskStartScheduler();
}

void loop() {
    // Insert background code here
}


acronis
Posts: 107
Joined: Thu Mar 02, 2017 12:32 pm

Re: [libmaple] SDIO

Post by acronis » Fri Aug 04, 2017 2:55 am

It turned out that the problem is in the order of connection of libraries


In this order works
#include <SPI.h>
#include "SdioF4.h"
#include <Adafruit_TFTLCD_16bit_STM32.h> // Hardware-specific library



In this order it gives an error

C:\Users\Admin\Documents\Arduino\libraries\SdFat\src/SdCard/SdSpiCard.h:264:51: error: macro "writeData" passed 2 arguments, but takes just 1

bool writeData(uint8_t token, const uint8_t* src);

#include <Adafruit_TFTLCD_16bit_STM32.h> // Hardware-specific library
#include <SPI.h>
#include "SdioF4.h"
Library FreeRTOS does not affect this error.
Code and without connection FreeRTOS gives an error if you connect the libraries in the wrong order.

Why is this happening ?

victor_pv
Posts: 1599
Joined: Mon Apr 27, 2015 12:12 pm

Re: [libmaple] SDIO

Post by victor_pv » Fri Aug 04, 2017 3:20 am

At the moment I am not using that core neither the Arduino IDE so I can't test myself.
I have had very strange things happen to with the Arduino IDE, apparently due to a bug in the software since changing to a newer version would solve it.
Sometimes it messes up with different versions of the library if you have different libraries with the same name for different cores, like one for the AVR arduinos, and one for the STM32.

A while back I stopped using the Arduino IDE and started using Eclipse, and I don't plan to go back.

Unless Steve can duplicate the same issue and give some advice, my only advice is to make sure you have downloaded the latest version of his F4 core, and to try a different version of the Arduino IDE.

acronis
Posts: 107
Joined: Thu Mar 02, 2017 12:32 pm

Re: [libmaple] SDIO

Post by acronis » Fri Aug 04, 2017 3:28 am

I understand You.

I use the last version of the IDE and the latest versions of the libraries.

And Eclipse use the same library or is there ?

stevestrong
Posts: 1502
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: [libmaple] SDIO

Post by stevestrong » Fri Aug 04, 2017 7:14 am

Why do you use <SPI.h>?
I see no reason for that. SDIO does not use SPI, and 16 bit lib is also not using SPI.
Arduino IDE is fine.
Btw, I think the problem is in the SdFat lib, it compiles the SPI related files and functions although only SDIO is needed.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests