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

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