4D Displays Picaso Libraries

Geekshow
Sat Jun 30, 2018 9:28 pm
Hi all,

I’m having some issues using the following libraries to enable my 4D Displays Picaso-based touchscreen LCD displays:
https://github.com/4dsystems/Picaso-Ser … no-Library

I can load the libraries without any issue, but as soon as I try the first command in their example the board keels over. I don’t have a debugger so can’t provide any more info sadly. I’ve highlighted the line below that I have experimentally determined that makes the board keel over, it’s likely this is the case as it is the first call to the library.

I’ve had a look through the library but not sure where to start. Help! :cry:

//Simple Demo that demonstrates 'print' and 'println' new functionality.

#define DisplaySerial Serial

//-------Picaso DISPLAYS-------

#include <Picaso_Const4D.h>
#include <Picaso_Serial_4DLib.h>

//use Serial0 to communicate with the display.
--------->>Picaso_Serial_4DLib Display(&DisplaySerial); <<------------
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FIRST PROBLEMS START WITH THIS LINE

//---------END-----------------

void setup() {
//For handling errors
Display.Callback4D = mycallback ;

//5 second timeout on all commands
Display.TimeLimit4D = 5000 ;

DisplaySerial.begin(9600) ;
........
.....
..


Geekshow
Sun Jul 01, 2018 1:00 pm
I also found an mbed library here which is reasonably easy to understand. Essentially the library is just a lookup for the various screen hex commands.

https://os.mbed.com/users/Kerpower/code/4DGL/

All help appreciated here…


stevestrong
Sun Jul 01, 2018 1:20 pm
Have you read this: viewtopic.php?f=2&t=3111 ?

Which core?
Which IDE?
Which upload method?

Here you won’t get support for mbed i’m afraid.


Rick Kimball
Sun Jul 01, 2018 1:33 pm
[Geekshow – Sat Jun 30, 2018 9:28 pm] –
In terms of hardware, I’m using the Olimexino STM32 boards which are really nice, and based on the Maple (not mini). The board has the original (leaflabs?) bootloader on it, not sure if this is a blocker or not. I tried updating but I can’t find how to pull the BOOT0 line high as it’s not routed anywhere on the board.

The schematic seems to indicate that the pressing the User Button will pull boot0 high.

https://www.olimex.com/Products/Duino/S … -STM32.pdf

“User button with name BUT connected to STM32F103RBT6 pin 40 (PC9/TIM3_CH4) via
R33 (1kΩ) and pin 60 (BOOT0) – signal BOOT0.”


Geekshow
Mon Jul 02, 2018 8:59 am
[Rick Kimball – Sun Jul 01, 2018 1:33 pm] –

[Geekshow – Sat Jun 30, 2018 9:28 pm] –
In terms of hardware, I’m using the Olimexino STM32 boards which are really nice, and based on the Maple (not mini). The board has the original (leaflabs?) bootloader on it, not sure if this is a blocker or not. I tried updating but I can’t find how to pull the BOOT0 line high as it’s not routed anywhere on the board.

The schematic seems to indicate that the pressing the User Button will pull boot0 high.

https://www.olimex.com/Products/Duino/S … -STM32.pdf

“User button with name BUT connected to STM32F103RBT6 pin 40 (PC9/TIM3_CH4) via
R33 (1kΩ) and pin 60 (BOOT0) – signal BOOT0.”

Good spot Rick, I missed that first time round. I’ll give it a go….


Geekshow
Mon Jul 02, 2018 9:13 am
[stevestrong – Sun Jul 01, 2018 1:20 pm] –
Have you read this: viewtopic.php?f=2&t=3111 ?

Quickly opens link and reads….

[stevestrong – Sun Jul 01, 2018 1:20 pm] –
Which core?

Using ‘maple’ core on STM32F103RBT6 (‘Maple Rev3’ board) from recent Arduino_STM32 libs found on Github

[stevestrong – Sun Jul 01, 2018 1:20 pm] –
Which IDE?

Arduino v1.8.5 running on Ubuntu linux (Bionic), with Arduino_STM32 libs downloaded from Github in June this year.

[stevestrong – Sun Jul 01, 2018 1:20 pm] –
Which upload method?

Using the built-in leaflabs DFU mode to download sketches to the board via on-board USB


stevestrong
Mon Jul 02, 2018 9:31 am
[Geekshow – Mon Jul 02, 2018 9:13 am] –
…with Arduino_STM32 libs downloaded from Github.

This is not “libs”, this is the core.

Try to use Serial1, it may happen that Serial (USB serial) is not yet “prepared” at the time you declare the lib instance.


Geekshow
Mon Jul 02, 2018 11:21 am
I’ve been able to flash the bootloader successfully, and I’ve tried the following options:

maple_rev3_boot20.bin – flashes successfully, however no LED activity on reboot, no USB device presented on PC after reset. Can’t seem to get into DFU mode.

maple_rev5_boot20.bin – flashes successfully, LED activity on reboot, however no USB device presented on PC. Can’t seem to get into DFU mode.

maple_mini_boot20.bin – flashes successfully, however no LED activity on reboot, no USB device presented on PC after reset. Can’t seem to get into DFU mode.

maple_boot.bin (from leaflabs site) – flashes successfully, LED activity on reboot, 1eaf/0003 USB device presented to PC after reset. Can flash sketches and everything works (board ‘Maple rev3’ selected in IDE).

I’m guessing I’m best sticking with the stock maple_boot.bin then? My board LEDs are connected to PA5/PA1, and USB connected through USB chip to pins 44,45 on the STM32F103 (USBDM->44/PA11, USBDP->45/PA12)

I’m observing USB activity on linux by looking at output of ‘dmesg’ which will show all USB activity including unrecognised devices.

Thanks for the pointers guys.


stevestrong
Mon Jul 02, 2018 11:49 am
Just keep the working bootloader and the working board selection in IDE.

Geekshow
Mon Jul 02, 2018 1:43 pm
Thanks, will do.

Any tips on where to start with the 4D displays library?


stevestrong
Mon Jul 02, 2018 1:48 pm
[stevestrong – Mon Jul 02, 2018 9:31 am] –
Try to use Serial1, it may happen that Serial (USB serial) is not yet “prepared” at the time you declare the lib instance.


Geekshow
Mon Jul 02, 2018 3:11 pm
[stevestrong – Mon Jul 02, 2018 1:48 pm] –

[stevestrong – Mon Jul 02, 2018 9:31 am] –
Try to use Serial1, it may happen that Serial (USB serial) is not yet “prepared” at the time you declare the lib instance.

Yep, I’ve been using Serial1. Apologies, the code I pasted earlier is from the unmodified example and doesn’t show this. I’ve tried both Serial1 and Serial2, same result, board seems.to die before entering the main loop{}. Removing the highlighted line means the board will boot and run normally.

I’ll have a look for old posts about migrating libraries to understand what I’m looking for. Could be a slow process but hopefully worth doing.


stevestrong
Mon Jul 02, 2018 7:01 pm
I would usually avoid passing Serial pointer at instance declaration time, exactly because of this reasons.

A more robust solution would be to implement a begin() function called in setup which would then pass the Serial pointer to the lib.


fpiSTM
Mon Jul 02, 2018 7:42 pm
Steve is right.
Try to remove the flush here:
https://github.com/4dsystems/Picaso-Ser … ib.cpp#L22

The begin is done after the call to flush.


Geekshow
Mon Jul 02, 2018 9:52 pm
Made some progress guys, thanks for the tips. :D

The serial port declaration seems to be okay outside the setup{} function, however removing the _virtualPort->flush();


stevestrong
Tue Jul 03, 2018 7:13 am
Any pics/videos how it works?
It would help other members interested in the same topic.

fpiSTM
Tue Jul 03, 2018 8:18 am
I think also that an issue could be opened on the library github to fix Serial management.

Edit: Seems not possible as they do not accept issue only Pull request :o :shock:


Geekshow
Tue Jul 03, 2018 8:42 pm
[stevestrong – Tue Jul 03, 2018 7:13 am] –
Any pics/videos how it works?
It would help other members interested in the same topic.

I’ve made a crude video but it should give the idea :)


Leave a Reply

Your email address will not be published. Required fields are marked *