Help debuging FRAM SPI breakout

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
Yasen6275
 
Posts: 10
Joined: Sun Nov 20, 2022 4:44 am

Help debuging FRAM SPI breakout

Post by Yasen6275 »

Hello
I'm trying to connect SPI FRAM breakout to XIAO nRF52840 using CircuitPython.
When provided examples threw OSError I tried to follow this generic SPI tutorial. I found out that i can't obtain a lock on the bus

Code: Select all

>>> while not spi.try_lock():
...     print("Trying to lock")
...     pass
I have triple checked the wiring. Also tried with Arduino UNO R3 with "No SPI FRAM found" or something like this.

Any idea what could be the problem?

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: Help debuging FRAM SPI breakout

Post by mikeysklar »

Please post a photo of the wiring and soldering.

Make sure you are running this example script.

https://github.com/adafruit/Adafruit_Ci ... pletest.py

User avatar
Yasen6275
 
Posts: 10
Joined: Sun Nov 20, 2022 4:44 am

Re: Help debuging FRAM SPI breakout

Post by Yasen6275 »

https://ibb.co/jGsfHhC
https://ibb.co/ZgbVqKs
https://ibb.co/Y7N8Gyx
https://ibb.co/WfYGr0c
Image

Yes the code is almost the same. The only difference is the cs pin. I'm using D7. I have tried D6 and D3.

Code: Select all

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Traceback (most recent call last):
  File "code.py", line 8, in <module>
  File "/lib/adafruit_fram.py", line 359, in __init__
OSError: FRAM SPI device not found.

Code done running.

Press any key to enter the REPL. Use CTRL-D to reload.

I'll try to use my multi meter in continuity mode from MC pads to elements on breakout board.

//
Continuity test from MC to components on breakout board was successful. Also tested for shorts between pins of breakout board, No shorts.

Sorry for bad pics, but that's the maximum my phone can do.

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: Help debuging FRAM SPI breakout

Post by mikeysklar »

It looks you are using the 5v pin on your SEEED XIAO (black wire). Be sure and change that to 3v3 since your have a 3v3 controller all the SPI communication should be happening at 3v3.

Also you have a blob of solder on the FRAM board end pin. Probably best to briefly go over each pin for a bit more flow.

User avatar
Yasen6275
 
Posts: 10
Joined: Sun Nov 20, 2022 4:44 am

Re: Help debuging FRAM SPI breakout

Post by Yasen6275 »

mikeysklar wrote: Tue Nov 22, 2022 3:20 pm It looks you are using the 5v pin on your SEEED XIAO (black wire). Be sure and change that to 3v3 since your have a 3v3 controller all the SPI communication should be happening at 3v3.
Does that mean that signals send from MC to FRAM was too low to be read correctly? But that didn't help.
mikeysklar wrote: Tue Nov 22, 2022 3:20 pm Also you have a blob of solder on the FRAM board end pin. Probably best to briefly go over each pin for a bit more flow.
Probably that was the problem. After reflowing all the pins, now i can read and write to FRAM. Thanks a lot for the suggestion. Any advice how to prevent that from happening again?
Last edited by Yasen6275 on Wed Nov 23, 2022 3:04 pm, edited 2 times in total.

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: Help debuging FRAM SPI breakout

Post by mikeysklar »

Your MC is a 3v3 device so you want everything hooked up to the be running at 3v3. The danger in using the 5v line off the XIAO and sending that over the FRAM is that when the FRAM is communicating back with the XIAO it will be doing so at 5v feeding into the XIAO SPI pin. You could damage the XIAO.

As far as the soldering I'm glad to hear that going over each pin again with a iron resolved the issue. Just making sure you get good flow on each pin will prevent this happening in the future. Your soldering should look more like puddles than blobs.

User avatar
Yasen6275
 
Posts: 10
Joined: Sun Nov 20, 2022 4:44 am

Re: Help debuging FRAM SPI breakout

Post by Yasen6275 »

Additional question

Code: Select all

import board
import busio
import digitalio
import adafruit_fram

spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
cs = digitalio.DigitalInOut(board.D7)
fram = adafruit_fram.FRAM_SPI(spi, cs)

i = 0
try :
    while True :
        fram[i] = 1
        i+=1

except :
    print(i, "bytes", i/1024, "KB") 
Will that code give me correct fram size? If yes I'll need to find my invoce. But that is not your concern. I have bought it from resaler.

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: Help debuging FRAM SPI breakout

Post by mikeysklar »

You have the right idea for determining the total FRAM capacity with a loop and summary of the valid address space.

You can also print large sections of values with:

Code: Select all

values = list(range(100))  # or bytearray or tuple
fram[0:100] = values
print(fram[0:100])

User avatar
Yasen6275
 
Posts: 10
Joined: Sun Nov 20, 2022 4:44 am

Re: Help debuging FRAM SPI breakout

Post by Yasen6275 »

OK the supplier asked me to discuss the size issue here.
What shell be the procedures if I have received wrong module?

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: Help debuging FRAM SPI breakout

Post by mikeysklar »

Which model did you order?

When you look at the chip on the FRAM breakout board what is the part#?

User avatar
Yasen6275
 
Posts: 10
Joined: Sun Nov 20, 2022 4:44 am

Re: Help debuging FRAM SPI breakout

Post by Yasen6275 »

I ordered 4MB/512kb one. Will try to post magnified part number after few hours.

User avatar
Yasen6275
 
Posts: 10
Joined: Sun Nov 20, 2022 4:44 am

Re: Help debuging FRAM SPI breakout

Post by Yasen6275 »

Image

Here it is.

Image

and packaging

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: Help debuging FRAM SPI breakout

Post by mikeysklar »

You have the 4Mbit (not mega byte) part that you ordered ADA# 4719. The chip numbers match. Thank you for the high quality photos.

https://www.adafruit.com/product/4719
4mb-fram.jpg
4mb-fram.jpg (573.82 KiB) Viewed 150 times

User avatar
Yasen6275
 
Posts: 10
Joined: Sun Nov 20, 2022 4:44 am

Re: Help debuging FRAM SPI breakout

Post by Yasen6275 »

Then why are I'm not able to write more than 8192 bytes?

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: Help debuging FRAM SPI breakout

Post by mikeysklar »

You had not mentioned the value you were seeing 8k addresses.

There is a different address size on the FRAM devices. The 4Mb is a 4-byte address size (32-bit or double word). It uses fram.begin(3) in the Arduino section of the guide. I realize how obscure that is when you are using CircuitPython. The smaller FRAM devices use the default 2-byte, single word address sizing.

https://learn.adafruit.com/spi-fram-2mb ... in-1658773
http://adafruit.github.io/Adafruit_FRAM ... s_p_i.html

You can try using this to determine fram size and work in a usable address space. I would expect your unit to show 125k usable addresses (32-bit per address).

Code: Select all

import board
import busio
import digitalio
import adafruit_fram

spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
cs = digitalio.DigitalInOut(board.D7)
fram = adafruit_fram.FRAM_SPI(spi, cs)

# size returned by len()
len(fram)

# can be used with range
for i in range(0, len(fram))

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”