Problems with mbed.h library in platformio

Hi,

i am using your SPI Slave API (SPISlave - API references and tutorials | Mbed OS 6 Documentation) to create a SPI Slave. But I have some problems because the library is not found. As a consequence I get these errors:

Can somebody help me how I can install the library in the right way or what I have to do? I am using platformio in VS Code

My code is:

I think the problem is the mbed.h library and I have to install it. But how can I install it? Or is there another mistake in my Code?

A second question: Is it possible to use a SPI clock frequency = 10Mhz with this API?

Thank you in advance!

Hi,

Arduino_nano_33_BLE inherits from NRF52840 and in the list of APIs the SPISlave is missing.

You can try to add, to your Platformio project, the SPISlave in mbed_app.json file but I think that API is not supported on this target, you will see.

{
    "target_overrides": {
        "*": {
            "target.device_has_add": ["SPISlave"]
        }
    }
}

BR, Jan

1 Like

Hi @JohnnyK ,

thank very much you for the response. Yes you are right. When I add the mbed_app.json the error is still there.

So the solution would be to use an other device? So I have to choose one that includes SPISlave in the list “device_has”: [… ]?

Do you know if I can use a SPI clock frequency = 10MHz with this API? Because the default is just 1MHz.

Best regards,
Marco

Hi,

yes, it is better choose target what have it in the list.
Nope, I do not know it but I think it depends on the hardware.

BR, Jan