Mosfet Hat

TonyD

New member
Giday having a slight problem Mosfet card Ver3
After setting a Mosfet output "Channel 1" ON & then try to read its status the returned (1 or 0).
9 time out of 10 it returns that the output is 0 OFF when in actual fact the led for channel 1 is actually ON
I have inserted numerus lengthy delays between reads of the card just to make sure that the I2C is not flooded with request

I have uploaded a short test program which is a stripped down function of my program
Cards in the Stack are
RPI5 Running 64Bit Latest OS for RPI5
PCIE M2.E 1MB SSD Hat

SmLCD Hat
RTD Hat
Mosfet Hat
Super Watchdog with UPS

Any help would be much appreciated
All Hats are current version purchased within last 2 Months
Cheers TonyD
 

Attachments

  • MosfetTest.txt
    7 KB · Views: 1

alexburcea

Moderator
Staff member
Hi,

The first thing I think of is the contact problem. Please use the provided standoffs to secure the cards.
I will like to make 2 experiments:
1) use the command 8mosind to read the card and see the behavior
2) use only 8mosfets card in the stack and repeat the test.
 

TonyD

New member
Giday
Help please
Could you please provide a little more info on running the command 8mosind as it doesn’t run from the command line.
Have commands 8mosfet & all the functions work from the command line
8mosfet 0 write 1 1
Turns on output 1 led lights
8mosfet 0 read 1
Returns a 1
The command 8mosfet read returns the correct information a 1
This is the same for all outputs

On a side not it would be nice if the commands across all cards were. ie the mosfet card doesn’t use -r as other cards use instead the hole word read is used
8mosfet 0 read 1
Other cards need 2 use -r
Also would be good if Leds on the mosfet card all went from left to right
12345678
Instead of
I think you may have a firmware problem
From command line
If I turn 1 on led 4 from the right turns on
If I turn l8 on 4 from left turns on as well as leds 6&7 from left turn on

I have not carried out any test rom python at this stage when I found the firmware problems
Please not I have not carried out all possible combinations after discovering the problem with output 8 I considered it a moot point


Regards TonyD
 
Last edited:

TonyD

New member
Giday
Further testing from command line
8mosfet 0 write 1 1
Turns on the 6th led counting from the flashing board light
8mosfet 0 read1
Returns a 1 this is correct
8mosfet 0 write 2 1
Turns on led 7 from left
Read is a 1
8mosfet 0 write 3 1
Turns on led 4th from the left
8mosfet 0 write 8 1
Turns on led 5 from the left

I think you may have a little problem with the firmware
I have not carried any further testing of the combinations after find these problems
Please note I have not verified if physical plug 1 corresponds to the 8mosfet 0 write 1 1

Sorry to be the bearer of bad news
Board revision is the latest firmware is V1.0.0

Regards
TonyD
 

TonyD

New member
Giday again
I have not carried out any further testing from python 2 verify that the outputs act the same way as the command line
I will test this a little later today
TonyD
 

TonyD

New member
Hi Again
Just carried out a couple of Python tests. Below is a screen shot of what i carried out

pi@raspberrypi:~/8mosfet-rpi $ python3
Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import lib8mosfet as mos
>>> mos.set(0,1,1) "This turned on led 6 counting from board flashing light"
>>> mos.get(0,1)
1
>>> mos.set(0,8,1) "This turned on led 5 counting from the board light
>>> mos.get(0,8)
1
>>>

It appears Python corresponds the same way as command line
Please not i have not tried further testing using the python code i uploaded in my first post
I await your earliest reply

Regards TonyD
 

TonyD

New member
I don’t think the cards uploaded
Attached again
Had 2 shrink them they were 2 big for your upload
Regards Tony
 

Attachments

  • IMG_2764.jpeg
    IMG_2764.jpeg
    102.2 KB · Views: 2
  • IMG_2763.jpeg
    IMG_2763.jpeg
    99.4 KB · Views: 2

alexburcea

Moderator
Staff member
Hi,

You have the last version of the card.
Please follow the text printed on the card, left and right can be confusing it depends how you look to the card.
8mosind 0 write 1 1 turn on led marked "CH1" and corresponding mosfet.
I just tested on the same version of the card and I do not see how your is different.
 

TonyD

New member
Giday
Yes the outputs run left to right from the board light 1-8
Please be aware Iam running this on a RPi5
Running the latest stable 64bit OS of the RPi web site

Maybe this could have something 2 do with it however all software was installed using the same procedures & all other cards are functioning correctly

I do have a old RPi3 with the latest 32bit OS currently running the old production software that I could try the card in & see if is different response

What RPi ?? & OS ??? did you run the test on
Regards
TonyD
 
Last edited:

alexburcea

Moderator
Staff member
Should have nothing to do with OS and raspberry type. I am using now Pi zero with 32bit os.
I will do the same with 5 and let you know, I am pretty confident will do the same.
Have to ask: You are sure that you use the latest 8mosind-rpi repo?
 

TonyD

New member
Giday
Yes am using the latest 8mosfet from your GitHub. Even tried update of the repo & it came back that on my RPi is the latest.
One thing that makes me think may be in the python driver is when I read a temp from a probe on rtd I get back an incredibly long long long long floating point number which I truncate using int() cause only interested in whole numbers

Regards
TonyD
 

TonyD

New member
Giday mate
Doing a little research
You mention am i using 8mosind-rpi answer is no have been using 8mosfet that your mostfet web page directs U to use
I have just found the https://github.com/SequentMicrosystems/8mosind-rpi/tree/main 8mosind repo
It may be advisable to ammend your web page to direct users to this new repo
I am going to download this & give it a try
I noticed that you had added new features 2 days ago

I will report back later today on how i went

Just downloaded the 8mosind repo & carried out make command. The following error messages might help U

pi@raspberrypi:~ $ git clone https://github.com/SequentMicrosystems/8mosind-rpi.git
Cloning into '8mosind-rpi'...
remote: Enumerating objects: 143, done.
remote: Counting objects: 100% (37/37), done.
remote: Compressing objects: 100% (22/22), done.
remote: Total 143 (delta 16), reused 27 (delta 12), pack-reused 106
Receiving objects: 100% (143/143), 109.99 KiB | 63.00 KiB/s, done.
Resolving deltas: 100% (69/69), done.
pi@raspberrypi:~ $ cd 8mosind-rpi/
pi@raspberrypi:~/8mosind-rpi $ sudo make install
[Compile] src/mosfet.c
src/mosfet.c: In function 'cliInit':
src/mosfet.c:897:9: warning: 'memcpy' writing 56 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
897 | memcpy(&gCmdArray, &CMD_TEST, sizeof(CliCmdType));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/mosfet.c:105:12: note: at offset 392 into destination object 'gCmdArray' of size 392
105 | CliCmdType gCmdArray[CMD_ARRAY_SIZE];
| ^~~~~~~~~
src/mosfet.c:899:9: warning: 'memcpy' writing 56 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
899 | memcpy(&gCmdArray, &CMD_VERSION, sizeof(CliCmdType));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/mosfet.c:105:12: note: at offset 448 into destination object 'gCmdArray' of size 392
105 | CliCmdType gCmdArray[CMD_ARRAY_SIZE];
| ^~~~~~~~~
[Compile] src/comm.c
[Compile] src/thread.c
[Link]
[Install]

I await your earlies reply
Regards TonyD
 

TonyD

New member
Giday
Further testing in spite of the error message when making the repo

I installed Python firmware using command

pi@raspberrypi:~/8mosind-rpi $ cd python
pi@raspberrypi:~/8mosind-rpi/python $ sudo python setup.py install

Below is the installed repo in Python that appears to work correctly
I turn on output 1 led 1 comes on
Please note that there are 2 warning with the install
It appears that the warnings have not effected the python firmware
Hear is the install screen result

pi@raspberrypi:~/8mosind-rpi $ cd python
pi@raspberrypi:~/8mosind-rpi/python $ sudo python setup.py install
running install
/usr/lib/python3/dist-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
/usr/lib/python3/dist-packages/setuptools/command/easy_install.py:146: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running bdist_egg
running egg_info
creating SM8mosind.egg-info
writing SM8mosind.egg-info/PKG-INFO
writing dependency_links to SM8mosind.egg-info/dependency_links.txt
writing requirements to SM8mosind.egg-info/requires.txt
writing top-level names to SM8mosind.egg-info/top_level.txt
writing manifest file 'SM8mosind.egg-info/SOURCES.txt'
reading manifest file 'SM8mosind.egg-info/SOURCES.txt'
adding license file 'LICENSE'
writing manifest file 'SM8mosind.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-aarch64/egg
running install_lib
running build_py
creating build
creating build/lib
creating build/lib/lib8mosind
copying lib8mosind/__init__.py -> build/lib/lib8mosind
creating build/bdist.linux-aarch64
creating build/bdist.linux-aarch64/egg
creating build/bdist.linux-aarch64/egg/lib8mosind
copying build/lib/lib8mosind/__init__.py -> build/bdist.linux-aarch64/egg/lib8mosind
byte-compiling build/bdist.linux-aarch64/egg/lib8mosind/__init__.py to __init__.cpython-311.pyc
creating build/bdist.linux-aarch64/egg/EGG-INFO
copying SM8mosind.egg-info/PKG-INFO -> build/bdist.linux-aarch64/egg/EGG-INFO
copying SM8mosind.egg-info/SOURCES.txt -> build/bdist.linux-aarch64/egg/EGG-INFO
copying SM8mosind.egg-info/dependency_links.txt -> build/bdist.linux-aarch64/egg/EGG-INFO
copying SM8mosind.egg-info/requires.txt -> build/bdist.linux-aarch64/egg/EGG-INFO
copying SM8mosind.egg-info/top_level.txt -> build/bdist.linux-aarch64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist/SM8mosind-1.0.1-py3.11.egg' and adding 'build/bdist.linux-aarch64/egg' to it
removing 'build/bdist.linux-aarch64/egg' (and everything under it)
Processing SM8mosind-1.0.1-py3.11.egg
Copying SM8mosind-1.0.1-py3.11.egg to /usr/local/lib/python3.11/dist-packages
Adding SM8mosind 1.0.1 to easy-install.pth file

Installed /usr/local/lib/python3.11/dist-packages/SM8mosind-1.0.1-py3.11.egg
Processing dependencies for SM8mosind==1.0.1
Searching for smbus2==0.4.2
Best match: smbus2 0.4.2
Adding smbus2 0.4.2 to easy-install.pth file

Using /usr/lib/python3/dist-packages
Finished processing dependencies for SM8mosind==1.0.1
pi@raspberrypi:~/8mosind-rpi/python $
pi@raspberrypi:~/8mosind-rpi/python $
pi@raspberrypi:~/8mosind-rpi/python $ python3
Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import lib8mosind as mos
>>> mos.get_all(0)
0
>>> mos.set(0, 1, 1)
>>> mos.get(0, 1)
1
>>>


Thanks for your assistance
Hope the above screen shot has been helpful & look forward to the web page link updated & further additions to the python firmware

Regards TonyD
 

TonyD

New member
Giday
All fixed card is performing as expected
Thank you for all the assistance you have give. Its a great testament to the support you provide to users

Regards
TonyD
 

alexburcea

Moderator
Staff member
If you have few minute to spear, write a review on the product page.
I should figure out that you use the older repo.. but always is room for better :)

Thanks again,
Alex.
 
Top