Go Down

Topic: 2.4 mcufriend - looking for information (Read 983 times) previous topic - next topic

F8VOA

OK , that's clear .
I was playing around with the SD ( work like a USB-stick  in som matter )
The world map shouldn't be 100% as I will use the map as a back-ground .
The only thing is that I need to adjust the map exactly in the middle of the tft screen  . The center  of the map ( that's my home - in amateur radio  we called that QTH-locator - mine is JN12CW ) should be x,y zero point .
And ... I have to study the rules of SD-cards and bitmaps in order to write a simple sketch ( showing the map on TFT 2.4" and 3.5 " ).
Many thanks for all the help you gave me David , I learned a lot.

Marco

F8VOA

Hi David , I'm a liddle bit lost . I tried to adapt some sketches into a simple SD-card reading sketch but I don't have sufficient knowledge . Itried to find some instructions but without succes .
Do you know where to find a simple sketch which I can introduce in my own sketch . Better was : to find the info neaded to write it by my self - a hint here is mostly welcom.

Marco

david_prentice

You can strip my SD example down to 24-bit colour .BMP files.    Just like Adafruit and other examples.

And if you know your SD filename,   there is no need to scan directories.    Just like Adafruit.

But another approach is to create a  .RAW file from the .BMP if you know the size and shape of your image.
This is what the UTFT utility does.

Of course life is more versatile if you use the established PC formats like .BMP or .JPG
These contain information about size, colour palettes etc

David.

F8VOA

OK , thanks , I started to strip your example but was lost in this . The problem with this methode is :

Every time after stipped some lines from the code , I rewrtite the code into the MEGA . But this methode is not working 100% . Even when I go to far in the stripping , the screen will continue working for a while . Then , at the end the sketch and screen stop working ( no more picture on the screen ) and it is impossible to find out at exactly what moment ( during the stripping ) it went wrong .

I will try again if there is no other way .

Thanks for your help
Marco

david_prentice

Post your code.    Someone might show you where you have gone wrong.

Personally,    I am happier with a printed listing.
I can sit down with a cup of tea and a pencil.    It is easy to see which statements you can remove.    A pencil is MUCH better than a pen.

This applies to any computer program that is difficult to follow.

I suspect that you use pencil and paper when designing your radio equipment.
You might draw a schematic and layout with CAD tools when you have made your main design decisions.

David.

F8VOA

Forgot to ask in my previous mail :
Do I need an other sketch for MEGA instead  UNO to recognize the SD-card ?

sorry for all the troubbles I make .

F8VOA

Yes , I do it that way whit my radio's ( old school ). But I builded and repared  so many radio's in my life time that I can do it blindly .
C++ is a whole other story - still learning every day but hard to find the right info .

I will do it on paper and then we , will see .

thanks ,
Marco

david_prentice

Yes,   the MEGA2560 has different SPI pins.   You have to use the "not_Uno" sketch and follow the instructions.

F8VOA

OK , I followed the instructions ( #define .....1 and SdFatSoftSpi<50, 51, 52> SD;) , I have the sketch uploaded , a blue screen and the Serial.print : cannot start SD .

So , I must do something wrong .

Marco

david_prentice

I checked the Library Manager.    SdFat is currently v1.0.14.    So I updated my SdFat library and edited my
C:\Users\David Prentice\Documents\Arduino\libraries\SdFat\src\SdFatConfig.h (around line #82)

Code: [Select]

/**
 * If the symbol ENABLE_SOFTWARE_SPI_CLASS is nonzero, the class SdFatSoftSpi
 * will be defined. If ENABLE_EXTENDED_TRANSFER_CLASS is also nonzero,
 * the class SdFatSoftSpiEX will be defined.
 */
#define ENABLE_SOFTWARE_SPI_CLASS 1


You do not need to edit the example sketch.

David.

F8VOA

OK David , thanks a lot ,
I'll work tomorrow because  my brain stopped after one day trying . :smiley-confuse:

I have the new SDFAT master library ( latest version ) with
/**
 * If the symbol ENABLE_SOFTWARE_SPI_CLASS is nonzero, the class SdFatSoftSpi
 * will be defined. If ENABLE_EXTENDED_TRANSFER_CLASS is also nonzero,
 * the class SdFatSoftSpiEX will be defined.
 */
#define ENABLE_SOFTWARE_SPI_CLASS 1

I have MISO 50 , MOSI 51 and SCK 52

I use de MCUFRIEND_kvb_master ( latest download )

 
Problem now : SDFatsoftspi doen not name a type

I do something wrong but will not find out this night what it can be .

Thanks for all you did to help me but it will not work today .

have a nice evening , Marco :)

F8VOA

Good morning David ,

I deleted this morning the sdfat.master.zip in the "Add.zip.library ".
I placed the unzipped  sdfat.master.file ( the whole folder ) directly in c:users.f8voa.documents.arduino.libraries ( the contributed library )

I have now following new lines in my sketch ( they appeared automaticly when I clicked on this library )

#include <BlockDriver.h>
#include <FreeStack.h>
#include <MinimumSerial.h>
#include <SdFat.h>
#include <SdFatConfig.h>
#include <sdios.h>
#include <SysCall.h>

I have no longer this " not mention a type " problem

The only warning I have is : we are using a special custom driver  ( that's normal , I suppose )

but the serial outputgive still : cannot start SD

I read on the forum some answers ( from 2015 ) with the same problem .
Following this instructions I tried to change : #define SD_CS     53//10 but without results.

One thing  : I plugged the screen 3.5" directly in the MEGA-board , I do not use Dupont bridges .
The screen react correctly with my rotator sketch and even with a bitmap ( no SD-card ) , but this bitmap is a very low quality .

Marco on a cloudy sunday morning.

david_prentice

#27
Jan 13, 2019, 11:40 am Last Edit: Jan 13, 2019, 11:42 am by david_prentice
God gave you the Library Manager.

1.  Always install / update libraries via the Library Manager.
2.  Enable Verbose Compilation in File->Preferences

When you build a sketch the IDE reports how much Flash / SRAM and which library versions were used.

Yes,   I know you get a whole load of dross but you can paste the important lines to your message e.g.
Code: [Select]

Using library U8g2 at version 2.24.3 in folder: C:\Users\David Prentice\Documents\Arduino\libraries\U8g2
Using library SPI at version 1.0 in folder: C:\Program Files (x86)\Arduino-1.8.1\hardware\arduino\avr\libraries\SPI
Using library Wire at version 1.0 in folder: C:\Program Files (x86)\Arduino-1.8.1\hardware\arduino\avr\libraries\Wire
Sketch uses 11606 bytes (35%) of program storage space. Maximum is 32256 bytes.
Global variables use 605 bytes (29%) of dynamic memory, leaving 1443 bytes for local variables. Maximum is 2048 bytes.

or
Code: [Select]

Using library SPI at version 1.0 in folder: C:\Program Files (x86)\Arduino-1.8.1\hardware\arduino\avr\libraries\SPI
Using library SdFat at version 1.0.14 in folder: C:\Users\David Prentice\Documents\Arduino\libraries\SdFat
Using library Adafruit_GFX_Library at version 1.3.6 in folder: C:\Users\David Prentice\Documents\Arduino\libraries\Adafruit_GFX_Library
Using library Mcufriend_kbv at version 2.9.9-Beta in folder: C:\Users\David Prentice\Documents\Arduino\libraries\Mcufriend_kbv
Sketch uses 32148 bytes (12%) of program storage space. Maximum is 253952 bytes.
Global variables use 1057 bytes (12%) of dynamic memory, leaving 7135 bytes for local variables. Maximum is 8192 bytes.

I can deduce a lot of things from these lines e.g. UNO or MEGA2560,   U8g2 sketch or Mcufriend_kbv,   ...
and most importantly where the libraries were found.

Quite honestly.   It is a nuisance to install and configure the SdFat library.   You only do it once.

You do not edit the showBMP_not_Uno.ino sketch.   It should run straight out of the box.

David.

F8VOA


I use Enable Verbose Compilation in File->Preferences to control were and what .

but I don't know how to copy all those files .

david_prentice

You don't have to copy any files.

You just copy-paste a few lines from the verbose compilation report.
You can copy the complete report with ctrl-A, ctrl-C.

As long as you put it in a Code Window your message is still readable.
It is just easier when you paste specific lines instead of the whole output.

Most Arduino problems go away when you use the Library Manager.
And it certainly makes it easier to reply to questions when we can see the library versions and locations.

David.

Go Up