Bug in the SPI component with Arduino

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Post Reply
Pascal_2016
Posts: 89
Joined: Wed Aug 31, 2016 4:48 pm
Been thanked: 4 times
Contact:

Bug in the SPI component with Arduino

Post by Pascal_2016 »

Hello Benj

I don't think the SPI component works with Arduino Nano and UNO.

I can't read and write the EEPROM 25LC512 and the MFRC522 with SPI.

If I choose a PIC24F16KA102 instead of the Arduino, I can read and write both the EEPROM and the MFRC522.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Bug in the SPI component with Arduino

Post by Benj »

Hello,

With AVR devices the processor can become locked if the SPI hardware SS pin is left as an input pin and allowed read a logic low. Ideally use the SS pin as your CS pin and this will use the pin as an output and overcome the problem.

It may be worth you attaching your project file I can have a look and suggest what might be going wrong.

Pascal_2016
Posts: 89
Joined: Wed Aug 31, 2016 4:48 pm
Been thanked: 4 times
Contact:

Re: Bug in the SPI component with Arduino

Post by Pascal_2016 »

Hello, Beny,

I use the SS pin as CS pin. Enclosed the program I posted on 22.02.2019 as "RFID "MFRC522 does not work", modified a bit. I also have the same problem with the PIC 18F26J50 there the SPI doesn't work either (same program). Should I also open an entry in the forum? Countercheck with a program to store in a 25LC512 doesn't work either. At the processors mentioned below the program runs.
The posted program runs best with a 24F16K102 and 24EP128MC202 with more processors - especially the 32bit processors - I haven't tried it yet.

Sometimes it would be very helpful for troubleshooting if you would reveal the code of your components.
Attachments
MFRC522_UID_Test.fcfx
(14.51 KiB) Downloaded 189 times

Pascal_2016
Posts: 89
Joined: Wed Aug 31, 2016 4:48 pm
Been thanked: 4 times
Contact:

Re: Bug in the SPI component with Arduino

Post by Pascal_2016 »

Hello Benj,

sorry I misspelled your name

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Bug in the SPI component with Arduino

Post by Benj »

sorry I misspelled your name
No worries :D

Write a value to pin B2 using an output icon before you initialise the SPI. This should hopefully fix the problem.

Pascal_2016
Posts: 89
Joined: Wed Aug 31, 2016 4:48 pm
Been thanked: 4 times
Contact:

Re: Bug in the SPI component with Arduino

Post by Pascal_2016 »

Hello, Benj,

unfortunately the measure is only conditionally crowned with success, because now the initialization is completed but he still does not recognize a card
Attachments
MFRC522_UID_Test.fcfx
(14.64 KiB) Downloaded 177 times

Pascal_2016
Posts: 89
Joined: Wed Aug 31, 2016 4:48 pm
Been thanked: 4 times
Contact:

Re: Bug in the SPI component with Arduino

Post by Pascal_2016 »

Hello, Benj,

I have now tested it with a PIC 16LF1939. Unfortunately it shows the same behavior as the Arduino. No card is detected.

The same program as under Arduino only with different SPI assignment and different configuration.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Bug in the SPI component with Arduino

Post by Benj »

Hello,

Please can you confirm you are running Flowcode 8.1 and using the latest version of the MFRC component.

Pascal_2016
Posts: 89
Joined: Wed Aug 31, 2016 4:48 pm
Been thanked: 4 times
Contact:

Re: Bug in the SPI component with Arduino

Post by Pascal_2016 »

Hello,

I have the latest version of Flowcode see Appendix and my components are also up to date see Appendix
Attachments
Komponenten.JPG
Komponenten.JPG (27.57 KiB) Viewed 7890 times
FlowcodeVersion.JPG
FlowcodeVersion.JPG (18.94 KiB) Viewed 7890 times

viktor_au
Posts: 342
Joined: Fri Jan 26, 2018 12:30 pm
Location: South Australia
Has thanked: 43 times
Been thanked: 60 times
Contact:

Re: Bug in the SPI component with Arduino

Post by viktor_au »

Hello Pascal_2016

Can you please tell what voltage do you use for MFRC522?

Example from datasheet:
Attachments
Voltage.jpg
Voltage.jpg (136.26 KiB) Viewed 7887 times

Pascal_2016
Posts: 89
Joined: Wed Aug 31, 2016 4:48 pm
Been thanked: 4 times
Contact:

Re: Bug in the SPI component with Arduino

Post by Pascal_2016 »

Hello viktor_au,

I operate the MFRC522 with 3.3V on an 18F26J50 because of the given range.

Also with the Arduino I run the MFRC522 with 3.3V. The MFRC522 works with the Arduino IDE. The MFRC522 does not work with Flowcode in the same constellation.

viktor_au
Posts: 342
Joined: Fri Jan 26, 2018 12:30 pm
Location: South Australia
Has thanked: 43 times
Been thanked: 60 times
Contact:

Re: Bug in the SPI component with Arduino

Post by viktor_au »

Can you share the IDE code and FC8 code?

Pascal_2016
Posts: 89
Joined: Wed Aug 31, 2016 4:48 pm
Been thanked: 4 times
Contact:

Re: Bug in the SPI component with Arduino

Post by Pascal_2016 »

Hello,

attached the IDE code. The Flowcode program see third entry.
Attachments
firmware_check.txt
(2.94 KiB) Downloaded 121 times

Pascal_2016
Posts: 89
Joined: Wed Aug 31, 2016 4:48 pm
Been thanked: 4 times
Contact:

Re: Bug in the SPI component with Arduino

Post by Pascal_2016 »

Hello, Benj,

unfortunately the MFRC522 with the Raspberry doesn't work either. The SPI interface is activated.

Pascal_2016
Posts: 89
Joined: Wed Aug 31, 2016 4:48 pm
Been thanked: 4 times
Contact:

Re: Bug in the SPI component with Arduino

Post by Pascal_2016 »

Hello Benj
with the new update the 24FJ64GB002 works, but the Arduino still doesn't recognize the card.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Bug in the SPI component with Arduino

Post by Benj »

Hello,

I think I have found the problem with the MFRC522 component. The default SPI properties are slightly incorrect but otherwise it works. I've pushed a new version to the update system which should hopefully change the defaults and solve any issues you're having with it.

You can confirm by clicking on view -> component debugger

Ticking the "expose full component tree" checkbox and then using the drop down list at the top of the properties window browsing to the CAL_SPI component.

Clock Phase = Trailing Edge
Clock Polarity = Idle High
Sample Point = End

On AVR devices you will still need to write to the SS pin before you initialise the MFRC522 component.

Pascal_2016
Posts: 89
Joined: Wed Aug 31, 2016 4:48 pm
Been thanked: 4 times
Contact:

Re: Bug in the SPI component with Arduino

Post by Pascal_2016 »

Hello, Benj,

The new update has worsened everything. Now neither Arduino nor the PICs 18F work... , 24F... . with the current update the MFRC522 doesn't recognize cards. it seems to me as if the component was delivered with the revision level which is two revision levels before the current revision level.

How can I change to the last revision where at least the PICs worked?

With the Arduino I can change the data to
Clock Phase = Trailing Edge
Clock Polarity = Idle High
Sample Point = End
confirm.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Bug in the SPI component with Arduino

Post by Benj »

Hello,

You should be able to select the component version in the update window. Just tick the "show up to date files" checkbox.

The latest version should be version 3.
RFID.jpg
RFID.jpg (77.67 KiB) Viewed 7578 times
With the Arduino I can change the data to
Clock Phase = Trailing Edge
Clock Polarity = Idle High
Sample Point = End
confirm.
This should be done for you using the latest v3 component, however if it's not working then double check these settings are correct.

Pascal_2016
Posts: 89
Joined: Wed Aug 31, 2016 4:48 pm
Been thanked: 4 times
Contact:

Re: Bug in the SPI component with Arduino

Post by Pascal_2016 »

Hello, Benj,

I meant in version 3 the MFRC522 doesn't recognize a card anymore, neither if I use the MFRC522 via an Arduino, PIC18F..., or PIC24F.... I operate.
In version 2 the MFRC522 recognized the cards UID when I control it via a PIC18F... or PIC 24F.... .

This BUG also belongs to my question "RFID "MFRC522" does not work".

Pascal_2016
Posts: 89
Joined: Wed Aug 31, 2016 4:48 pm
Been thanked: 4 times
Contact:

Re: Bug in the SPI component with Arduino

Post by Pascal_2016 »

Hello Benj

when I control the MFRC522 with an Arduino UNO this constellation behaves as if no update had been done. The program does not go beyond the initialization phase of the MFRC522.

Pascal_2016
Posts: 89
Joined: Wed Aug 31, 2016 4:48 pm
Been thanked: 4 times
Contact:

Re: Bug in the SPI component with Arduino

Post by Pascal_2016 »

Hello Benj

you could please send me the version 2 of the component MFRC522, because this version works together with the PIC 24F. I urgently need this component because I can't continue with my project.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Bug in the SPI component with Arduino

Post by Benj »

Hello,

You can roll back versions using the help -> Check for updates window.

Just change the New Revision to the version you want to move to and then click Download.

Use the show up to date files check box to show files that are on the latest version.

Make sure you have output to the SPI SS pin before initialising the component to avoid a SPI related lockup when initialising.

Post Reply