Hi
Just found a bug in this component , when using Channel 1 the micro controller hangs in the Initialize macro as if it had entered
in a loop and will not exit until hardware reset .
When using the same i/o ports but in software mode it works ok . I am using Arduino mega 2560 R3
also another thing i found out is that i was able to work only with 2GB Micro SD , when i inserted an 8GB
will not work ( in the pc works fine ) .
FAT Component ( Micro SD )
Moderator: Benj
- 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: FAT Component ( Micro SD )
Hello,
Thanks I have had a similar report on the initialise hanging so I will look into this.
Regarding the 8GB card, please can you ensure it is formatted with the FAT32 file system. Large cards like this may come with a different formatting mechanism e.g. NTFS but should work fine once they are formatted to FAT.
Thanks I have had a similar report on the initialise hanging so I will look into this.
Regarding the 8GB card, please can you ensure it is formatted with the FAT32 file system. Large cards like this may come with a different formatting mechanism e.g. NTFS but should work fine once they are formatted to FAT.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- 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: FAT Component ( Micro SD )
Aha, Brainwave.
Right if the AVR SPI SS pin is left floating as an input then it has the chance of locking the SPI peripheral. Ideally the SS pin (Pin B2 or Digital 10 on an Arduino Uno / Pin B0 or Digital 53 on an Arduino Mega 2560) should be used as the Chip Select pin. This way the pin is set to be an output and the chance of a lock up is removed.
You can test this theory by using say an output icon to write a 1 or 0 to the SS pin before initialising the FAT component, once you have done this the lock up problem should be gone.
Right if the AVR SPI SS pin is left floating as an input then it has the chance of locking the SPI peripheral. Ideally the SS pin (Pin B2 or Digital 10 on an Arduino Uno / Pin B0 or Digital 53 on an Arduino Mega 2560) should be used as the Chip Select pin. This way the pin is set to be an output and the chance of a lock up is removed.
You can test this theory by using say an output icon to write a 1 or 0 to the SS pin before initialising the FAT component, once you have done this the lock up problem should be gone.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- Alan_37
- Posts: 179
- Joined: Sun May 01, 2016 8:36 pm
- Has thanked: 51 times
- Been thanked: 54 times
- Contact:
Re: FAT Component ( Micro SD )
Hi Benj
Regarding the SD i have tried for format it to FAT,FAT16 AND FAT32 but no luck i even try to make a
2gb partition and format as fat32 but it dose not work.
Regarding the slave select Pin a have used B7 which have an LED connected to it so i can see in software
mode i can see it blinking , but when Channel 1 is selected it dose not blink it just remains on all the time .
Regarding the SD i have tried for format it to FAT,FAT16 AND FAT32 but no luck i even try to make a
2gb partition and format as fat32 but it dose not work.
Regarding the slave select Pin a have used B7 which have an LED connected to it so i can see in software
mode i can see it blinking , but when Channel 1 is selected it dose not blink it just remains on all the time .
- 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: FAT Component ( Micro SD )
Hello,
Sorry I didn't explain very well.
The AVR microcontroller has a hardware SS pin for the SPI. If this hardware pin is in input mode when SPI is enabled and if the pin is allowed to read as a low input then the SPI peripheral will automatically go into Slave SPI mode and block any Master SPI communications.
On your Arduino Mega 2560 this hardware SS pin is Pin B0 or Digital 53.
Set this pin to be an output and the lock up problem should be solved.
Using the hardware SS pin as your Master CS pin will ensure you never have the problem.
This is an extremely frustrating "feature" of AVRs that I'm sure has wasted many hours of many peoples time.
With your large 8GB card, FAT16 can only support up to 2GB. FAT32 should work fine. Maybe try increasing the SPI prescalers (slow down the bus) and see if that allows the card to start functioning.
Sorry I didn't explain very well.
The AVR microcontroller has a hardware SS pin for the SPI. If this hardware pin is in input mode when SPI is enabled and if the pin is allowed to read as a low input then the SPI peripheral will automatically go into Slave SPI mode and block any Master SPI communications.
On your Arduino Mega 2560 this hardware SS pin is Pin B0 or Digital 53.
Set this pin to be an output and the lock up problem should be solved.
Using the hardware SS pin as your Master CS pin will ensure you never have the problem.
This is an extremely frustrating "feature" of AVRs that I'm sure has wasted many hours of many peoples time.
With your large 8GB card, FAT16 can only support up to 2GB. FAT32 should work fine. Maybe try increasing the SPI prescalers (slow down the bus) and see if that allows the card to start functioning.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- Alan_37
- Posts: 179
- Joined: Sun May 01, 2016 8:36 pm
- Has thanked: 51 times
- Been thanked: 54 times
- Contact:
Re: FAT Component ( Micro SD )
Hi Benj
You are right setting B0 to 1 before init fixes the Problem .
As for the 8gb SD must be one of those chinese fake or somthing , couse now i tried another one 16GB and worked fine .
Thanks for your support
You are right setting B0 to 1 before init fixes the Problem .
As for the 8gb SD must be one of those chinese fake or somthing , couse now i tried another one 16GB and worked fine .
Thanks for your support