Arduino_core_stm32: SPI external eeprom suport

Created on 2 Oct 2019  Â·  6Comments  Â·  Source: stm32duino/Arduino_Core_STM32

hello @fpistm ,
I want to integrate SPI based external EEPROM with STM32F103C controller, The issue is the EEPROM is not responding to SPI.h library.
I have tested the EEPROM on Arduino UNO using This Code

here they have used ATMEL specific instructions

//sample on leading edge of clk,system clock/4 rate (fastest)
  SPCR = (1<<SPE)|(1<<MSTR);
  clr=SPSR;
  clr=SPDR;

which are not supported on stm.
Please suggest the solution for this.
other details: Arduino IDE :- 1.8.0
STMCore: 1.7.0(latest).

regards,
Mayur

Help wanted

All 6 comments

Hi @mayurharge
your code is for UNO direct register access. I guess this example was made before API update.
You have to create your own sketch using SPI API:
https://www.arduino.cc/en/reference/SPI

Did you test some third party libraries, ex:
https://github.com/regis44/spieeprom

Okay I will Try this

I have tried the library you suggested its behaving same.
The error I am facing is
I will get random values like 0,31(32-1),127(128-1),255(256-1) if i read a particular register
I am attaching the .ino file I am using, please check.
SPI_EEPROM.zip

@mayurharge
unfortunately, I'm not able to review all third party or user code and debug it.
Your code seems to be a lot of copy/paste and try and use deprecated API.
Please take time to make your code and try to debug it.

Sure

On Wed, 2 Oct, 2019, 7:55 PM Frederic Pillon, notifications@github.com
wrote:

@mayurharge https://github.com/mayurharge
unfortunately, I'm not able to review all third party or user code and
debug it.
Your code seems to be a lot of copy/paste and try and use deprecated API.
Please take time to make your code and try to debug it.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/stm32duino/Arduino_Core_STM32/issues/678?email_source=notifications&email_token=AKDWW63U5RZJK2AHSUGVDOTQMSVNLA5CNFSM4I4V3AM2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAE54WQ#issuecomment-537517658,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AKDWW63EHAUWOXRIFRFDFXDQMSVNLANCNFSM4I4V3AMQ
.

The issue is solved.
There was problem with spi speed.
After reducing the speed the communication was fine

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Pararera picture Pararera  Â·  5Comments

fpistm picture fpistm  Â·  7Comments

romainreignier picture romainreignier  Â·  7Comments

Hoel picture Hoel  Â·  4Comments

SuperBoss9 picture SuperBoss9  Â·  6Comments