Problem with VidorDrawLogo

DarioPennisi:
Hi,
if you run VidorDrawLogo example and are stuck with the original logo likely the issue is that you didn't connect to the USB serial with the monitor.
the issue is that the Serial object being declared in the setup() function is the USB virtual serial port, so the sketch will remain stuck there until you connect with a terminal.
in particular the setup function looks like:

void setup() {
Serial.begin(115200);
while (!Serial){}

// Initialize the FPGA
if (!FPGA.begin()) {
Serial.println("Initialization failed!");
while (1) {}
}

delay(4000);
}

so the while !(Serial){} is basically locking everything out until you connect through USB terminal.
if you comment all references to Serial the sketch will run immediately. if you don't want to connect through USB virtual com port please modify that as follows:

void setup() {
// Serial.begin(115200);
// while (!Serial){}

// Initialize the FPGA
if (!FPGA.begin()) {
// Serial.println("Initialization failed!");
while (1) {}
}

delay(4000);
}

I was indeed using the serial monitor...

so... you download the sketch, you open the serial monitor and don't see anything, not even the initialization failed error message?
what if you add a print if the initialization is ok? do you see it?

how are you powering the board?

DarioPennisi:
so... you download the sketch, you open the serial monitor and don't see anything, not even the initialization failed error message?
what if you add a print if the initialization is ok? do you see it?

how are you powering the board?

I did see the output but not the failure message... Could you please go through my comment first? I understand you must be quite busy right now, but please...

Anyway... what I did:

  1. Original VidorDrawLogo sketch + Serial Monitor + USB 3.0 power = Bootloader logo only
  2. Original sketch with only Serial-related codes removed + 5V 1A phone charger = Bootloader logo only
  3. Following modified setup() + Serial Monitor + USB 3.0 power = endless loop in "Waiting for FPGA..."
void setup() {
  Serial.begin(115200);
  while (!Serial) {}

  // Initialize the FPGA
  if (!FPGA.begin()) {
    Serial.println("Initialization failed!");
    while (1) {}
  }

  Serial.println("Waiting for FPGA...");
  for (int i = 0; !FPGA.ready(); ++i) {
    Serial.println(i);
    delay(1000);
  }

  auto version = FPGA.version();
  Serial.print("FPGA version: ");
  Serial.println(version);

  delay(1000);
}

I've also got an official Raspberry Pi 5.1V 2.5A charger... haven't tried it out yet cos I read Vidor 4000 allows only 5V input somewhere... If you give me the green light I can also give it a shot.

Hi Frederick,
i probably went through your first comment but forgot that when i wrote. sorry but there alre lots of things going on and as you can see i don't always keep track of everything.
5.1V is fine but i don't think this is the issue as a USB3 port should be just fine.
i just tested the exact same sketch on a couple of boards i have here and it works so there must be some issue somewhere.
there are two possibilities... one is that there is a problem with flash initialization and the other is that there is an issue with SAM bootloader.
i don't have the possibility to immediately push an update to VidorGraphics but i would ask you to try replacing the app.ttf file under VidorGraphics library with the one attached here (after unzipping it of course) and let me know if this makes any difference.
if it doesn't then there still is some possibility there is an issue with some flash related code but while we create another version of the ttf you may want to try (if you have AT-SAM ICE) to reload the SAM bootloader via Arduino IDE as i am getting the sensation some boards may have been shipped with an old version of the bootloader that is causing some trouble. to reload bootloader you would have to select tools->burn bootloader after you selected Atmel-SAM ICE under programmer (under tools) and connect that through the 6 pads on the bottom of the board. i usually do that witout soldering the connector... just fit some strips in the female header of the programmer and make contact... burning bootloader is very fast...
if you are not able to do the above i should be able to post another bitstream to test later today.

app.zip (396 KB)

DarioPennisi:
i don't have the possibility to immediately push an update to VidorGraphics but i would ask you to try replacing the app.ttf file under VidorGraphics library with the one attached here (after unzipping it of course) and let me know if this makes any difference.

I replaced my ~/Arduino/libraries/VidorGraphics-master/src/app.ttf with the new one and it resulted in ...

Verify 680460 bytes of flash with checksum.
Verify failed
An error occurred while uploading the sketch

May I know how to fix it?

And sorry I don't have the programmer.

Hi Frederick,
verification failure is not a problem. this is because the header information in VidorGraphics.cpp is not updated for this bitstream however it should run anyway.
once loaded what happens if you just reset the board and open the terminal?

DarioPennisi:
Hi Frederick,
verification failure is not a problem. this is because the header information in VidorGraphics.cpp is not updated for this bitstream however it should run anyway.
once loaded what happens if you just reset the board and open the terminal?

Nothing changes with the new app.ttf and FPGA.version() is still FFFFFFFF... I removed the code I added so it didn't block in setup() but still what all I could see was the bootloader logo.

Hi Frederick,
if you reload the bootloader using the instructions here ([Solved] FPGA boot loader recovery - MKRVIDOR4000 - Arduino Forum) do you see a green spot on the top left side?
thanks,

Dario

DarioPennisi:
Hi Frederick,
if you reload the bootloader using the instructions here ([Solved] FPGA boot loader recovery - MKRVIDOR4000 - Arduino Forum) do you see a green spot on the top left side?
thanks,

Dario

I had done the 'recovery' before carrying out all the tests I mentioned above. And actually I can see a green square in the upper-right corner of my screen instead of upper-left.

Same results also from me.
With the new app nothing has changed compared to the old one.
Nothing has changed since the FPGA Recovery.

I confirm that the green rectangle is at the top right.

Hi Everyone,

There was some issues with the bitstream provided in the original VidorGraphics library. We've pushed an updated version to Github: GitHub - vidor-libraries/VidorGraphics: VidorGraphics "fat" library repository - for issues/PR refer to

Please re-download the library and add to your sketchbook to get the fixes.

sandeepmistry:
Hi Everyone,

There was some issues with the bitstream provided in the original VidorGraphics library. We've pushed an updated version to Github: GitHub - vidor-libraries/VidorGraphics: VidorGraphics "fat" library repository - for issues/PR refer to

Please re-download the library and add to your sketchbook to get the fixes.

Sorry but as reported by a2retro, the updated library still gave me the same results.

I confirm: no change after updating the library.

Please be sure to have the version
version=1.0.1

of the lib, you can check it by reading the file /home/luca/Arduino/libraries/VidorGraphics-master/library.properties

let us know if that is the case.

Also, please let us know the output of the serial monitor. As well as trying again after power cycling the board.

lcipriani:
Please be sure to have the version
version=1.0.1

of the lib, you can check it by reading the file /home/luca/Arduino/libraries/VidorGraphics-master/library.properties

let us know if that is the case.

sandeepmistry:
Also, please let us know the output of the serial monitor. As well as trying again after power cycling the board.

  • Version == 1.0.1: Confirmed
  • Original VidorDrawLogo serial output: None
  • My VidorDrawLogo serial output: Waiting for FPGA...\n0\n1\n2\n3\n4 (endless)
  • Reset button: Tried for several times. made no difference.

I confirm what Frederick wrote, with the original example on the serial nothing comes.
With the example I modified:

void loop()
{ char S[12];
  /**
  *  Draw an Arduino logo
  */

  // Let's discover which version we are running
  int version = FPGA.version();
  Serial.print("Vidor bitstream version: ");
  Serial.println(version, HEX);

  // Let's also ask which IPs are included in this bitstream
  FPGA.printConfig();

  sprintf(S, "[%08d] Start screen draw...", millis());
  Serial.println(S);

  // Fill the screen with a white background
  vdgfx.fillRect(0,0,640,480,vdgfx.White(),1);

  sprintf(S, "[%08d] ...filled...", millis());
  Serial.println(S);

  /**
  *  The library allows drawing some basic elements to the view, like circles, rectangles, lines
  */  

  vdgfx.fillCircle(225,225,100 ,vdgfx.lightBlue(),1);
  sprintf(S, "[%08d] ...Circle1...", millis());
  Serial.println(S);
  vdgfx.fillCircle(415,225,100 ,vdgfx.lightBlue(),1);
  sprintf(S, "[%08d] ...Circle2...", millis());
  Serial.println(S);
  vdgfx.fillCircle(225,225,90 ,vdgfx.White(),1);
  sprintf(S, "[%08d] ...circle3...", millis());
  Serial.println(S);
  vdgfx.fillCircle(415,225,90 ,vdgfx.White(),1);
  sprintf(S, "[%08d] ...Circle4...", millis());
  Serial.println(S);
  vdgfx.fillRect(175,220,100,10 ,vdgfx.lightBlue(),1);
  sprintf(S, "[%08d] ...Rect1...", millis());
  Serial.println(S);
  vdgfx.fillRect(365,220,100,10 ,vdgfx.lightBlue(),1);
  sprintf(S, "[%08d] ...Rect2...", millis());
  Serial.println(S);
  vdgfx.fillRect(410,175,10,100 ,vdgfx.lightBlue(),1);
  sprintf(S, "[%08d] ...Rect3...", millis());
  Serial.println(S);

  /**
  *  To draw a text we can use the classic functions like write() and print()
  *  Text size, color and position can be changed using the .text subclass
  */
  vdgfx.text.setCursor(150,375);
  vdgfx.text.setAlpha(1);
  vdgfx.text.setSize(3);
  vdgfx.text.setColor(vdgfx.lightBlue());
  vdgfx.println("TEST");
  sprintf(S, "[%08d] ---printed TEST...", millis());
  Serial.println(S);
  vdgfx.text.setCursor(480,145);
  vdgfx.text.setSize(1);
  vdgfx.println("TM");
  sprintf(S, "[%08d] ...printed TM...", millis());
  Serial.println(S);

  sprintf(S, "[%08d] ...STOP!", millis());
  Serial.println(S);

  while (1) {
  }
}

The following log arrives on the serial:

Vidor bitstream version: FFFFFFFF
number of devices 0
[00017103] Start screen draw...
[00022105] ...filled...
[00027106] ...Circle1...
[00032107] ...Circle2...
[00037108] ...circle3...
[00042109] ...Circle4...
[00047110] ...Rect1...
[00052111] ...Rect2...
[00057112] ...Rect3...
[00077116] ---printed TEST...
[00087118] ...printed TM...
[00087118] ...STOP!

It does not read the bitstream version, it does not read the devices present and every call to the library ends by timeout (5000ms).
It seems like there is not a mailbox attached to the virtual JTAG.

Hi,
just to nail things down a bit... first of all upload an empty sketch. this will prevent FPGA to be programmed with the application image and should stay in the boot image. eventually use the procedure to restore the boot image as per [Solved] FPGA boot loader recovery - MKRVIDOR4000 - Arduino Forum

once this is done and you're sure you are in the boot image then you can reload the VidorDrawLogo sketch. that will load the sketch and the fpga image. note that it will take a while, up to a minute, after you see that download succeeded before the board is rebooted with the new software. this happens because the verification phase is silent (we're addressing this).

once this is complete you should see that image has been loaded correctly and that the sketch should finally display the programmatically drawn logo.

if you see errors then either you have a problem with boot image or there is something wrong in the transition from boot to application images.

DarioPennisi:
Hi,
just to nail things down a bit... first of all upload an empty sketch. this will prevent FPGA to be programmed with the application image and should stay in the boot image. eventually use the procedure to restore the boot image as per [Solved] FPGA boot loader recovery - MKRVIDOR4000 - Arduino Forum

once this is done and you're sure you are in the boot image then you can reload the VidorDrawLogo sketch. that will load the sketch and the fpga image. note that it will take a while, up to a minute, after you see that download succeeded before the board is rebooted with the new software. this happens because the verification phase is silent (we're addressing this).

once this is complete you should see that image has been loaded correctly and that the sketch should finally display the programmatically drawn logo.

if you see errors then either you have a problem with boot image or there is something wrong in the transition from boot to application images.

did what you described, twice. still ended up with no luck. nothing changes :frowning:

Loaded an empty sketch:

Lo sketch usa 10608 byte (4%) dello spazio disponibile per i programmi. Il massimo è 262144 byte.
Atmel SMART device 0x10010005 found
Device       : ATSAMD21G18A
Chip ID      : 10010005
Version      : v2.0 [Arduino:XYZ] Jun 20 2018 16:38:19
Address      : 8192
Pages        : -129
Page Size    : 64 bytes
Total Size   : 4194295KB
Planes       : 1
Lock Regions : 16
Locked       : none
Security     : false
Boot Flash   : true
BOD          : false
BOR          : false
Arduino      : FAST_CHIP_ERASE
Arduino      : FAST_MULTI_PAGE_WRITE
Arduino      : CAN_CHECKSUM_MEMORY_BUFFER
Erase flash
done in 0.860 seconds

Write 10752 bytes to flash (168 pages)

[===========                   ] 38% (64/168 pages)
[======================        ] 76% (128/168 pages)
[==============================] 100% (168/168 pages)
done in 0.073 seconds

Verify 10752 bytes of flash with checksum.
Verify successful
done in 0.007 seconds
CPU reset.

Performed physical reset (power off) of the card.
No video appears on the screen, only by double clicking on the button is the logo with the green rectangle at the top right.
At this point I loaded the modified VidorDrawLogo with the debug messages:

Lo sketch usa 17584 byte (6%) dello spazio disponibile per i programmi. Il massimo è 262144 byte.
Atmel SMART device 0x10010005 found
Device       : ATSAMD21G18A
Chip ID      : 10010005
Version      : v2.0 [Arduino:XYZ] Jun 20 2018 16:38:19
Address      : 8192
Pages        : -129
Page Size    : 64 bytes
Total Size   : 4194295KB
Planes       : 1
Lock Regions : 16
Locked       : none
Security     : false
Boot Flash   : true
BOD          : false
BOR          : false
Arduino      : FAST_CHIP_ERASE
Arduino      : FAST_MULTI_PAGE_WRITE
Arduino      : CAN_CHECKSUM_MEMORY_BUFFER
Erase flash
done in 0.842 seconds

Write 680460 bytes to flash (10633 pages)

[                              ] 0% (64/10633 pages)
[                              ] 1% (128/10633 pages)
[                              ] 1% (192/10633 pages)
[                              ] 2% (256/10633 pages)
[                              ] 3% (320/10633 pages)
[=                             ] 3% (384/10633 pages)
[=                             ] 4% (448/10633 pages)
[=                             ] 4% (512/10633 pages)
[=                             ] 5% (576/10633 pages)
[=                             ] 6% (640/10633 pages)
[=                             ] 6% (704/10633 pages)
[==                            ] 7% (768/10633 pages)
[==                            ] 7% (832/10633 pages)
[==                            ] 8% (896/10633 pages)
[==                            ] 9% (960/10633 pages)
[==                            ] 9% (1024/10633 pages)
   [...]
[===========================   ] 90% (9600/10633 pages)
[===========================   ] 90% (9664/10633 pages)
[===========================   ] 91% (9728/10633 pages)
[===========================   ] 92% (9792/10633 pages)
[===========================   ] 92% (9856/10633 pages)
[===========================   ] 93% (9920/10633 pages)
[============================  ] 93% (9984/10633 pages)
[============================  ] 94% (10048/10633 pages)
[============================  ] 95% (10112/10633 pages)
[============================  ] 95% (10176/10633 pages)
[============================  ] 96% (10240/10633 pages)
[============================= ] 96% (10304/10633 pages)
[============================= ] 97% (10368/10633 pages)
[============================= ] 98% (10432/10633 pages)
[============================= ] 98% (10496/10633 pages)
[============================= ] 99% (10560/10633 pages)
[============================= ] 99% (10624/10633 pages)
[==============================] 100% (10633/10633 pages)
done in 3.063 seconds

Verify 680460 bytes of flash with checksum.
Verify successful
done in 33.484 seconds
CPU reset.

The video with the green rectangle always remains on the screen and the usual messages, interspersed with waiting 5s, arrive on the serial line.

Vidor bitstream version: FFFFFFFF
number of devices 0
[00016573] Start screen draw...
[00021575] ...filled...
[00026576] ...Circle1...
[00031577] ...Circle2...
[00036578] ...circle3...
[00041579] ...Circle4...
[00046580] ...Rect1...
[00051581] ...Rect2...
[00056582] ...Rect3...
[00076586] ---printed TEST...
[00086588] ...printed TM...
[00086588] ...STOP!

If it were a hardware problem interfacing between MCU and FPGA, the library of VidorSketchTest should not work, instead that works.