It's the FAT component actually working???

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

Moderator: Benj

Post Reply
407charles
Posts: 122
Joined: Thu Jun 26, 2014 12:01 pm
Has thanked: 41 times
Been thanked: 19 times
Contact:

It's the FAT component actually working???

Post by 407charles »

Hi guys, I did a program model using the Arduino Mega for saving EEprom contents to FAT and downloading back to EEprom, in the simulator the program works. I start by writing four lines of data to EEprom and then I upload to Fat three times (three different sectors). Then, I opened the file EEprom.txt to check content, it's all accurate. Finally, I pressed download and after all the data is being transferred, I check the contents on EEprom by using the console. You will see that the content has been transferred to EEprom in the same byte order. So yes, in the simulator it works but when I tried with hardware, it did not pass the "Initialization" step.
I did all the possible research , and I even try an example from the Arduino website to see if I have the same results (because I doubt about having the right hardware), but in this case the controller was able to communicate with the SD card, create the file, wrote the file but was not able to open it. I check with my SD card reader and the file was created but I was not able to open it either. Therefore, I don't know if this component is actually working on Fowcode6 or not with the Arduino controller.
Now, I got some questions because still the possibility that my hardware is not the right one. :(

1) What kind of SD card should I use?
2) What file domain should I use (because I'm using EEprom.txt)?
3) What setting should I use in the panel properties. SPI Channel1, right?
4) There is any SD module that would work better than others? I'm using one from Ebay.
5) There is any preferable formatting protocol fot the SD card?

Does anybody else have the same issue or have this component working? I don't know if I'm doing something wrong.
I will greatly appreciate if somebody can help me with this, I'm not an experience programmer like some of you guys. I hope someone can help me soon. :( .Thanks a lot for your time.
Attachments
2016-08-30 (2).png
Here the results.
(110.16 KiB) Downloaded 4583 times
2016-08-30 (1).png
Here the results.
(108.92 KiB) Downloaded 4583 times
Mega_KS0108_ASCII_Eprom_FAT3 (1).fcfx
Here is my model.
(49.93 KiB) Downloaded 398 times

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: It's the FAT component actually working???

Post by Benj »

Hello,

1) What kind of SD card should I use?

The component should work with most types of SD card. I would avoid really cheap cards and buys from a reputable vendor. eBay and Amazon may sell you fakes.

2) What file domain should I use (because I'm using EEprom.txt)?

".txt" is fine, as is any other three character extension.

3) What setting should I use in the panel properties. SPI Channel1, right?

SPI channel 1 uses the SPI channel 1 on your microcontroller. If this is what you've connected your card to then yes this is correct. The software mode will allow for more choice in terms of pin connections but may run slower.

4) There is any SD module that would work better than others? I'm using one from Ebay.

It depends, what voltage is your microcontroller running at? If 3V3 then you can connect directly the microcontroller pins to the card, very simple. If 5V then you need to level shift the outputs from the microcontroller (CS, SCK, MOSI). To do this you can use potential divider circuits or a logic level shifter IC.

5) There is any preferable formatting protocol fot the SD card?

FAT or FAT32 should both work fine. FAT32 is generally used for cards larger than 2GB.



One final thing to look for when working with the cards is the initial speed and the high speed prescalers. Make sure these are nice and slow when starting out, you can always increase the speed at a later date once you know it is working.

407charles
Posts: 122
Joined: Thu Jun 26, 2014 12:01 pm
Has thanked: 41 times
Been thanked: 19 times
Contact:

Re: It's the FAT component actually working???

Post by 407charles »

would you take a look to my program? Can you tell me if its right? I will appreciate that.
I will check with another card. But why the arduino program actually did communicate with card and flowcode didn't?

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: It's the FAT component actually working???

Post by stefan.erni »

I have more or less the same problem. In the simulation the fat_init is working but in my hardware not. I can not pass the Initialise fat.
If I control it with the oscilloscope the clock and the mosi signals are good, but the miso (card out) is always high....
I used different card's Fat16 and Fat32

407charles
Posts: 122
Joined: Thu Jun 26, 2014 12:01 pm
Has thanked: 41 times
Been thanked: 19 times
Contact:

Re: It's the FAT component actually working???

Post by 407charles »

Thanks a lot for your feedback, I hope to get help soon to solve this issue.

407charles
Posts: 122
Joined: Thu Jun 26, 2014 12:01 pm
Has thanked: 41 times
Been thanked: 19 times
Contact:

Help needed, FAT component not working

Post by 407charles »

I made a program model to copy contents from EEprom to FAT and vice versa using the Arduino Mega. The program only works on the simulator and not with hardware. I already tested all my hardware, my control voltages are at 3.3v (MISO, MOSI and CLK) and CS is 2.8v. I'm using a SanDisk SDHC class 4 with 16Gb. To make sure that my hardware was functional, I did run an SD example ("SD card test") from the "Arduino website" and it ran ok (it has communication with SD card), but when trying my program with FLOWCODE6 it don't even goes through the "initialize macro". There is no communication between microcontroller and FAT. The CS pin is working and I set the initialize clock speed to 250 MHz to and I tried all the other speeds for the SPI high speed (transfer data clock). I'm sure the component is not functional, please I need help to make this work, I really need this component. I'm uploading my program for review (maybe I did something wrong?) and the result from the Arduino program for the SD card (I tried two different cards to check results).
Attachments
Mega_KS0108_ASCII_Eprom_FAT3 Hardware.fcfx
My program model
(50.49 KiB) Downloaded 408 times
2016-09-10.png
Arduino program results
(75.78 KiB) Downloaded 4534 times

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: It's the FAT component actually working???

Post by kersing »

There is no need to start a new thread on exactly the same subject as the existing, active thread, so I merged the new message with the existing thread.
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

407charles
Posts: 122
Joined: Thu Jun 26, 2014 12:01 pm
Has thanked: 41 times
Been thanked: 19 times
Contact:

Re: It's the FAT component actually working???

Post by 407charles »

Hello dear Kersing, with all the respect you deserve, the purpose of this thread was to find out if the FAT component worked or not. The idea was to post and hope for someone who could share this information with me (if it works or not based in project experience with Arduino) because I had doubts on my hardware. However, I bought new hardware (including a SD card reader) and tried my best but it did not work, however, the Arduino program worked ok so I found the answer, the FAT component does not work, at least with the Arduino controller. That's why I opened another thread to report this issue "Fat component inoperative with Arduino controller" because you guys are the only ones who can solve this issue. I hope you understand the reason, this component is very important to me. There is not other programing software like FLOWCODE but it will be the best if all the components work for all controllers. :roll:

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: It's the FAT component actually working???

Post by kersing »

I understand the component is important to you. If you require a component for a project like you do and it does not work it is at least inconvenient and often a major set back. However, anyone reading the forum saw your question and the response you got and are able to conclude for themselves there probably is an issue with the component based on your messages and the response from 'stefan.erni'. If you are in any doubt if the message gets across adding a message to that extend to your existing thread is all that is required. Adding a new thread in the general Flowcode V6 forum does not increase the chances of it being resolved, it does however leave people reading the forum wondering why two threads on the same subject have been posted.
If you want to report a bug it is better to create a new message in the Flowcode V6 bug reports section, if you include a link to the existing messages people reading it can get all the information on the subject without having to search the forum.

EDIT: I have copied your bug report to the FC6 bug reports section. http://www.matrixtsl.com/mmforums/viewt ... 975#p76975
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

407charles
Posts: 122
Joined: Thu Jun 26, 2014 12:01 pm
Has thanked: 41 times
Been thanked: 19 times
Contact:

Re: It's the FAT component actually working???

Post by 407charles »

Great! Thanks a lot. :mrgreen:

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: It's the FAT component actually working???

Post by Benj »

Hello,

Did you try running any of the example programs from the Wiki to see if they work correctly?

I'm certainly not aware of any issues with the FAT component in v6 in fact I was under the impression it was very stable. The only thing you have to get right is that the initial SPI speed is not too fast to break the 400KHz startup frequency required by the cards.

I have some Arduino boards on route so I should be able to test this here shortly.

407charles
Posts: 122
Joined: Thu Jun 26, 2014 12:01 pm
Has thanked: 41 times
Been thanked: 19 times
Contact:

Re: It's the FAT component actually working???

Post by 407charles »

Hi Benj, I tried one of the WIKI examples (FAT_Read_File) with my hardware but it does not work, looks like there is no communication with the SD card. The return value is 0xFF but it retrieves this value even with MISO and MOSI lines disconnected. An example from the Arduino website is able to communicate and works with my hardware, so I discard the possibility of not functional parts. I did create a "test.txt" file in notepad and save it to SD card, the WIKI example supposed to display the contents of the file but it's not even initializing. I'm using a class 4 SanDisk SDHC and I tried three more regular SD cards from different brands with the same result, I also checked my voltages to the card pins and are all 3.3 v. I hope you can solve this issue soon. Thanks a lot for your support. Best regards! :mrgreen:
Attachments
FAT_Read_File (2).fcfx
This is the program already adapted for Arduino Uno and 20x4 display.
(9.77 KiB) Downloaded 341 times

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: It's the FAT component actually working???

Post by Benj »

Hello,

I simply changed the initial prescaler from 64 to 128 in your program and it started working for my various SD test cards. Not sure why but 250KHz at /64 seems to still be too fast for the initialise.
20160919_142331.jpg
20160919_142331.jpg (107.93 KiB) Viewed 16214 times

407charles
Posts: 122
Joined: Thu Jun 26, 2014 12:01 pm
Has thanked: 41 times
Been thanked: 19 times
Contact:

Re: It's the FAT component actually working???

Post by 407charles »

HI, Benj. Thanks for your quick reply on the FAT issue. I was very excited when I red your post that I want it to try it immediately, unfortunately it did not work for me. Now it just return the byte 237 "0xED - Sector Bytes Error" on all my cards. I retrieve the return code from the forum that you provide to one of the members.

Return Codes
0xFF - No Card Error
0xFE - No Response Error
0xFD - No Ack Error
0xFC - Timeout Error
0xFB - Reserved Error
0xFA - Bad Sector Error
0xEF - File Not Found Error
0xEE - Root Full Error
0xED - Sector Bytes Error
0x03 - File Empty
0x02 - File Type
0x01 - End Of File
0x00 - Ok

407charles
Posts: 122
Joined: Thu Jun 26, 2014 12:01 pm
Has thanked: 41 times
Been thanked: 19 times
Contact:

Re: It's the FAT component actually working???

Post by 407charles »

It works!! I tried changing just the initial pre-scale to 128 as discussed but when I tried it did not work. This time I was having communications with the SD card and it was sending back a byte "0xED - Sector Bytes Error". Then after posting the previous message I decide to try a different pre-scale setting for the high speed data transfer to 64 and... it does communicate and display the data correctly!! why the difference between my results and yours?? You just needed to change one pre-scale setting an I had to change two, why?? maybe the hardware used?? It was just a setting problem the whole time but how to figure this out when the software actually tells you that the initialize clock should be below 400kHz which it was correctly set it to 250KHz. It does not matter, I'm happy with this component being functional, now I can finished my project. Thanks a lot for your help. I'm posting the program with Arduino Uno. Thanks again! :mrgreen: I also have to say that the program on my first post its working as needed.
Attachments
FAT_Read_File _Arduino.fcfx
It works!!
(9.77 KiB) Downloaded 293 times

407charles
Posts: 122
Joined: Thu Jun 26, 2014 12:01 pm
Has thanked: 41 times
Been thanked: 19 times
Contact:

Re: It's the FAT component actually working???

Post by 407charles »

Hi guys, i forgot to say that the " create file macro " does not work correctly. I tried and I was not able to read the contents even when I tried to opened it using world pad. However, it works perfectly when I create the file using world pad. So, open world pad on windows accessories and click on file save as to save it in SD card, then run the programs.

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: It's the FAT component actually working???

Post by Benj »

Hello,

When you create the file are you opening the file afterwards? You need to create and then open and it should work.

I've just used this to create a log file from a dsPIC and the file was created correctly without me having to manually create it on a PC.

If you are having problems with this then please attach your program so we can have a look and try to replicate the issue.

407charles
Posts: 122
Joined: Thu Jun 26, 2014 12:01 pm
Has thanked: 41 times
Been thanked: 19 times
Contact:

Re: It's the FAT component actually working???

Post by 407charles »

Hello Benj, thanks a lot for your quick response. I did open the file after being created and it did but not in the .txt format so I was not able to see the contents using my SD card reader. I was expecting to see the contents after the file was created and contents where copied to FAT. I did not try to upload the contents to verified if it work or not so I did create a file using the PC and everything was loaded and I was able to see the contents using my SD card reader, It works like a champ no complains at all so I successfully finished my project. I will try again to see what happens, the program I tried is extremely long and it has a lot of hardware so it's not practical for this purpose, I may try to make a smaller one using this macro to confirm this issue. Thanks a lot

Post Reply