Flexcan, canbus... brain fried and confused

Yea.... think I will give up trying to get this working with a 3.2

Code:
WARNING: Category 'Utility' in library FlexIO_t4 is not valid. Setting to 'Uncategorized'
WARNING: Category 'display' in library DFRobot_ST7687S is not valid. Setting to 'Uncategorized'
WARNING: Category '' in library GFX Library for Arduino is not valid. Setting to 'Uncategorized'
New_screen_clock_demo: In function 'uint8_t conv2d(const char*)':
New_screen_clock_demo:68: warning: operation on 'p' may be undefined 
     return (10 * (*p - '0')) + (*++p - '0');

                                           ^

New_screen_clock_demo:67: warning: unused variable 'v' 
     uint8_t v = 0;

             ^

C:\Users\steve\Documents\Arduino\Ford Ranger Gauges 2022\New_screen_clock_demo\New_screen_clock_demo.ino: At global scope:

New_screen_clock_demo:76: warning: 'xMin' defined but not used 
 static int16_t xMin, yMin, xMax, yMax;                               // redraw range

                ^

New_screen_clock_demo:76: warning: 'yMin' defined but not used 
 static int16_t xMin, yMin, xMax, yMax;                               // redraw range

                      ^

New_screen_clock_demo:76: warning: 'xMax' defined but not used 
 static int16_t xMin, yMin, xMax, yMax;                               // redraw range

                            ^

New_screen_clock_demo:76: warning: 'yMax' defined but not used 
 static int16_t xMin, yMin, xMax, yMax;                               // redraw range

                                  ^

New_screen_clock_demo:81: warning: 'cached_points_idx' defined but not used 
 static uint16_t cached_points_idx = 0;

                 ^

New_screen_clock_demo:82: warning: 'last_cached_point' defined but not used 
 static int16_t *last_cached_point;

                 ^

C:\Users\steve\Documents\Arduino\libraries\GFX_Library_for_Arduino\src\databus\Arduino_SWSPI.cpp: In member function 'virtual void Arduino_SWSPI::begin(int32_t, int8_t)':

C:\Users\steve\Documents\Arduino\libraries\GFX_Library_for_Arduino\src\databus\Arduino_SWSPI.cpp:199:5: error: '_misoPinMask' was not declared in this scope

     _misoPinMask = digitalPinToBitMask(_miso);

     ^

Error compiling for board Teensy 3.2 / 3.1.

What the heck does all that faff mean lol

To be fair, most of that pops up even when compiling for a 4.0. Nothing I add to the library seems to actually work. .....and walk away
 
OK. Just so that I don't end up stabbing pins around again...

The display requires Din. Din = Miso correct?

So, the Teensy 4.0 has default Mosi on 11 and Miso on 12. Does my Din connection on the screen go on 11 or 12? I used 11 (Master out, slave in).
 
OK then, new 4.0... LCD screen purring along nicely.

Images. I want to display 240x240 images on the screen. There is a demo in the GFX library showing a .c files being displayed.

My question. How do I create the .c image in colour? All the online converters appear to be black and white?

I would assume I can add some external flash memory to the 4.0 SPI bus, and I think that may be the way to obtain fast image loading times? I will into that.

I could use an SD card, but that will be slower
 
Rezo... very interesting and a nice job!

I will look into the LVGL. Did not know about that option.

I will have to research all this a lot further. How did you determine the scales etc for you data and work out how to decode the Canbus? I have found my Ford Canbus addresses, but no idea how to implement them.
 
Well just downloaded a whole pile of LVGL libraries and examples. None of them compile.

Not in the mood for sitting for hours working out why. Job for another day
 
Well just downloaded a whole pile of LVGL libraries and examples. None of them compile.

Not in the mood for sitting for hours working out why. Job for another day

I understand your frustration!
It can be quite complex to set up at first, but it a very flexible and advanced library
Forum member SKpang has something for the T4.0 on an SPI display for lvgl v7 (latest is v8.2 and the API is quite different)
https://github.com/skpang?tab=repositories&q=lvgl&type=&language=&sort=

You can give it a try, just use a different display driver library
 
I sent a whole evening on the LVGL stuff and got nowhere. I could not get anything to work (or even compile correctly).

Trouble is, people have a go and then it's not kept up to date (at least that is what I find). Then chumps like me have a go and don't understand why none of it works.
 
Steve what display driver and SPI pins are you using right now?
Can you perhaps send a code example of something that is working? I'll try get an example of LVGL up for you
 
Can anyone point out what is wrong here (clearly alot)....

Code:
#include <Arduino_GFX_Library.h>
#include "flashloader.h" 
#include <SD.h>

File root;

#if defined(__IMXRT1052__) || defined(__IMXRT1062__)
// PJRC Teensy 4.x
#define TFT_CS 10                        // Used to be pin 39  // GFX_NOT_DEFINED for display without CS pin
#define TFT_DC 9                         // Used to be pin 41
#define TFT_RST 8                        // Used to be pin 40
#define TFT_BL 7                         // Used to be pin 22              
#endif

// SD card CS = 5

Arduino_DataBus *bus = new Arduino_HWSPI(TFT_DC, TFT_CS);


/***************************************
   Start of Canvas (framebuffer)                                                                     WHAT THE F### DOES THIS ALL MEAN ? ###############################################################
 **************************************/
// 16-bit color Canvas (240x320 resolution only works for ESP32 with PSRAM)
// Arduino_G *output_display = new Arduino_ST7789(bus, TFT_RST, 0 /* rotation */, true /* IPS */);
// Arduino_GFX *gfx = new Arduino_Canvas(240 /* width */, 320 /* height */, output_display);

// Indexed color Canvas, mask_level: 0-2, larger mask level mean less color variation but can have faster index mapping
// Arduino_G *output_display = new Arduino_ST7789(bus, TFT_RST, 0 /* rotation */, true /* IPS */);
// Arduino_GFX *gfx = new Arduino_Canvas_Indexed(240 /* width */, 320 /* height */, output_display, 0 /* output_x */, 0 /* output_y */, MAXMASKLEVEL /* mask_level */);

// 3-bit color Canvas, R1G1B1, 8 colors
// Arduino_G *output_display = new Arduino_ILI9488_3bit(bus, GFX_NOT_DEFINED /* RST */, 1 /* rotation */, false /* IPS */);
// Arduino_GFX *gfx = new Arduino_Canvas_3bit(480 /* width */, 320 /* height */, output_display, 0 /* output_x */, 0 /* output_y */);

// Mono color Canvas
// Arduino_G *output_display = new Arduino_ST7789(bus, TFT_RST, 0 /* rotation */, true /* IPS */);
// Arduino_GFX *gfx = new Arduino_Canvas_Mono(240 /* width */, 320 /* height */, output_display, 0 /* output_x */, 0 /* output_y */);
/***************************************
   End of Canvas (framebuffer)
 **************************************/


// GC9A01 IPS LCD 240x240
//Arduino_GFX *gfx = new Arduino_GC9A01(bus, TFT_RST, 0 /* rotation */, true /* IPS */);
Arduino_GFX *gfx = new Arduino_GC9A01(bus, 7 /* RST */, 0 /* rotation */, true /* IPS */);                    


/*******************************************************************************
   End of GFX setting
 ******************************************************************************/

I cannot get the display to initialise correctly. I managed to cut down the library to the required lines above, but something is still amiss with the initialisation of the screen.
It stays blank on power up.

But, if you toggle the following lines (uncomment, load them and then reverse that process), then screen comes on. But only once. Next power up, it is blank again

//Arduino_GFX *gfx = new Arduino_GC9A01(bus, TFT_RST, 0 /* rotation */, true /* IPS */);
Arduino_GFX *gfx = new Arduino_GC9A01(bus, 7 /* RST */, 0 /* rotation */, true /* IPS */);

Reset is connected to pin 8 on the Teensy 4, but putting that into the above statement does not work. Neither does -1. Would help if I understood any of it
 
If you can get the display working (is it 240x240 or 128x128?) on the Teensy 4.0 I have an example ready to share that should work with LVGL v8.2
 
Sorry... had the flu. Totally knocked for six

it's 240x240. Just going to sit here now and see if I can make any headway
 
Does anyone know what this commented code is for in the example?

Code:
/***************************************
   Start of Canvas (framebuffer)                                                                     WHAT THE F### DOES THIS ALL MEAN ? ###############################################################
 **************************************/
// 16-bit color Canvas (240x320 resolution only works for ESP32 with PSRAM)
// Arduino_G *output_display = new Arduino_ST7789(bus, TFT_RST, 0 /* rotation */, true /* IPS */);
// Arduino_GFX *gfx = new Arduino_Canvas(240 /* width */, 320 /* height */, output_display);

// Indexed color Canvas, mask_level: 0-2, larger mask level mean less color variation but can have faster index mapping
// Arduino_G *output_display = new Arduino_ST7789(bus, TFT_RST, 0 /* rotation */, true /* IPS */);
// Arduino_GFX *gfx = new Arduino_Canvas_Indexed(240 /* width */, 320 /* height */, output_display, 0 /* output_x */, 0 /* output_y */, MAXMASKLEVEL /* mask_level */);

// 3-bit color Canvas, R1G1B1, 8 colors
// Arduino_G *output_display = new Arduino_ILI9488_3bit(bus, GFX_NOT_DEFINED /* RST */, 1 /* rotation */, false /* IPS */);
// Arduino_GFX *gfx = new Arduino_Canvas_3bit(480 /* width */, 320 /* height */, output_display, 0 /* output_x */, 0 /* output_y */);

// Mono color Canvas
// Arduino_G *output_display = new Arduino_ST7789(bus, TFT_RST, 0 /* rotation */, true /* IPS */);
// Arduino_GFX *gfx = new Arduino_Canvas_Mono(240 /* width */, 320 /* height */, output_display, 0 /* output_x */, 0 /* output_y */);
/***************************************
   End of Canvas (framebuffer)
 **************************************/
 
Does anyone know what this commented code is for in the example?

Code:
/***************************************
   Start of Canvas (framebuffer)                                                                     WHAT THE F### DOES THIS ALL MEAN ? ###############################################################
 **************************************/
// 16-bit color Canvas (240x320 resolution only works for ESP32 with PSRAM)
// Arduino_G *output_display = new Arduino_[COLOR="#FF0000"]ST7789[/COLOR](bus, TFT_RST, 0 /* rotation */, true /* IPS */);
// Arduino_GFX *gfx = new Arduino_Canvas(240 /* width */, 320 /* height */, output_display);

// Indexed color Canvas, mask_level: 0-2, larger mask level mean less color variation but can have faster index mapping
// Arduino_G *output_display = new Arduino_[COLOR="#FF0000"]ST7789[/COLOR](bus, TFT_RST, 0 /* rotation */, true /* IPS */);
// Arduino_GFX *gfx = new Arduino_Canvas_Indexed(240 /* width */, 320 /* height */, output_display, 0 /* output_x */, 0 /* output_y */, MAXMASKLEVEL /* mask_level */);

// 3-bit color Canvas, R1G1B1, 8 colors
// Arduino_G *output_display = new Arduino_[COLOR="#FF0000"]ILI9488[/COLOR]_3bit(bus, GFX_NOT_DEFINED /* RST */, 1 /* rotation */, false /* IPS */);
// Arduino_GFX *gfx = new Arduino_Canvas_3bit(480 /* width */, 320 /* height */, output_display, 0 /* output_x */, 0 /* output_y */);

// Mono color Canvas
// Arduino_G *output_display = new Arduino_[COLOR="#FF0000"]ST7789[/COLOR](bus, TFT_RST, 0 /* rotation */, true /* IPS */);
// Arduino_GFX *gfx = new Arduino_Canvas_Mono(240 /* width */, 320 /* height */, output_display, 0 /* output_x */, 0 /* output_y */);
/***************************************
   End of Canvas (framebuffer)
 **************************************/

@SteveSFX: I would guess that those are examples of the required settings & syntax for graphics driver chips that most likely have absolutely nothing to do with your 240x240, since it would appear from one of your earlier posts (snippet pasted below) that your display uses the GC9A01 driver chip. I may be misinterpreting you earlier post, but that is my best guess. It seems to me that you can just ignore those other examples as they don't apply for you . . . maybe even delete them so that they are not such a distraction.

Code:
// GC9A01 IPS LCD 240x240
//Arduino_GFX *gfx = new Arduino_[COLOR="#FF0000"]GC9A01[/COLOR](bus, TFT_RST, 0 /* rotation */, true /* IPS */);
Arduino_GFX *gfx = new Arduino_GC9A01(bus, 7 /* RST */, 0 /* rotation */, true /* IPS */);

Hope that helps . . .

Mark J Culross
KD5RXT
 
Back
Top