SPI not working with MBED (was: Performance of XIAO with Sharp Memory Display)

I think the input is CMOS so it shouldnā€™t need power.

In the case of mbed, the data transfer interval of 20uS is dominant, so even at 2MHz, the throughput will hardly decrease.

What happens if you change the setting back to software SPI and run it with pins other than D8 and D10?

hmm I think then Iā€™m back to post 1, where it ā€œworksā€ but is incredibly slow?
Or did I miss something that would have changed since then?

I used the pins as follows:
D10 for MOSI
D8 for SCK
D4 for SS/CS

You are using pins other than D10 and D8 for MOSI and SCK, right?

Since OLED is working, what about the proposal to change Sharp to OLED?
I bought 128X64 for less than $10.

No, I use D10 for MOSI and D8 for SCK as per https://how2electronics.com/wp-content/uploads/2022/05/Pinout.jpg

I used D4 for SS since I donā€™t think it makes a difference which one I use?

I had the oled and already tested it in real life. The project depends on being sunlight readable and fast update (so no eink) and the OLED was literally invisible.

Oh, you mean when using softSPI? Yes, I did use 4-6 then

Since D8 and D10 are hardware SPI pins, why donā€™t you try using pins other than D8 and D10 in software SPI configuration.

sorry I was late, see above. I used D4-D6 for soft SPI.
Or maybe not. Itā€™s late and Iā€™m tired, need to try tomorrow.

Ok resoldered to test it.

#define SHARP_SCK  6
#define SHARP_MOSI 5
#define SHARP_SS   4

Adafruit_SharpMem display(SHARP_SCK, SHARP_MOSI, SHARP_SS, SCREEN_WIDTH, SCREEN_HEIGHT, 2000000);

I get around 2Hz like this when using MBED :frowning:
Around 10Hz non-mbed (which would be okay, but using non-mbed still makes me rewrite the whole bluetooth-code which I honestly donā€™t understand how toā€¦ :frowning:

Letā€™s call it a day.
I donā€™t have Sharp on hand, so I am limited, but I will give it some thought.

1 Like

I set the clock to 2 MHz and checked the waveform again. 1 byte transfer time is
mbed : 24uS
non-mbed : 8.5uS
The throughput of mbed is about 1/3. The frame rate difference may be the correct result.

Iā€™m also working on a ā€œ2-peripheralā€ version using non-mbed, but I do not even know if it is possible to expand to ā€œ2-peripheralā€ in the first place. I still need more time.

You mean using the Bluefruit-library?
I think there is even an example for this in Adafruit Bluefruit NRF52 libraries ā†’ Central ā†’ central_bleuart_multi

I may give it a go in the next hours as wellā€¦

would you expect the hardware SPI on mbed to work normally or also slowed down? I mean, do you expect the limitation to only affect soft SPI?

so I just integrated everything into my codebase again and switch back and forth between hard and soft SPI.

Using soft SPI, I get around 1.5Hz, with hard SPI, I get almost exactly 9Hz - which would look good enough, if I would get any output using the hard SPI-pins.

If you PM me your address, Iā€™m going to gift you one.

You mean using the Bluefruit-library?

Yes.
It is a totally non-mbed prototype, but I was able to connect two peripherals and transfer data. Still needs to be debugged.

1 Like

Using soft SPI, I get around 1.5Hz, with hard SPI, I get almost exactly 9Hz - which would look good enough, if I would get any output using the hard SPI-pins.

According to the data sheet, the frame frequency is 20 Hz when the clock frequency is 2 MHz. mbedā€™s hardware SPI throughput is 1/3, so 9 Hz should be sufficient.
Just to confirm, itā€™s 9Hz in mbed, right?

Wow, thatā€™s awesome. I would be ready to test and help debug.

exactly, yes. 9-10 Hz using mbed and hardware SPI (which shows no output).

(which shows no output)

What do you mean? Does it mean it doesnā€™t work?

thatā€™s my main problem yes :slight_smile:
mbed and SPI never produced any output to me with the Sharp-display.
I only know the framerate because I log it to the console.

The prototype will be sent by e-mail as soon as it is ready. Please forgive me for the prototype. The comments are in Japanese for the most part. The data is simply millis() and battery voltage.
I would be really happy if you could debug it and use it!

Sorry, I have started a project to connect multiple peripherals to a PC.
I will look into the limitations of mbedā€™s SPI a bit more.

1 Like