Author Topic: ATSAM20C adding a display using MPLab Harmony  (Read 904 times)

0 Members and 1 Guest are viewing this topic.

Offline DLXXVTopic starter

  • Newbie
  • Posts: 6
  • Country: us
    • Kosciusko Media
ATSAM20C adding a display using MPLab Harmony
« on: October 11, 2023, 04:34:19 am »
Hey guys,
Thanks for having me. I’m having an issue that’s making me want to switch MCUs but I don’t really want to.
The ATSAMC20N is the only 5v I can find with the power and enough pins. I don’t want to use a bunch of level shifters and io expanders. Anyway, the issue I’m having is adding a display to my project.

I want to use a simple and cheap ST7789 SPI display but can’t figure out how to do it. Microchip’s tutorials and examples are all over the place depending on the chip, the family and often thinks you should have a dev board. So I’m having trouble finding how to add this display. I’ve done a lot of trials and searching but not much luck.

From what I have gathered it looks as though I am to use the GLCD module from MCC in Harmony but my chip’s core doesn’t include those libraries. Any suggestions? Thanks. I can had that module it appears I would be able to make the driver with Harmony but as I said I don’t have that module listed.
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11261
  • Country: us
    • Personal site
Re: ATSAM20C adding a display using MPLab Harmony
« Reply #1 on: October 11, 2023, 05:24:11 am »
GLCD is a peripheral for controlling segment LCD displays. SAM C2x don't have that, only SAM L2x devices have that peripheral. But it is also useless for ST7789.

There is not support for ST7789 in Harmony, so you would have to either make a driver yourself or use one of many available from various sources. It will not fit exactly into the Harmony ecosystem, so you would just have to use SPI or whatever interface your display supports and bridge that to the actual driver.

If you want to use graphical library from Harmony, then your only option is to implement the driver in a way that meets the requirements of the graphics library. There is a generic driver that can be used as a template, but I don't think it will work as is.

The only demo application for the SAM C20/C21 (gfx_apps_sam_c20_c21/tree/master/apps/legato_quickstart) uses ILI9488 driver, which should be close to ST7789 in principle. But it is not something you can just drag and drop, some manual programming would be required.

Also, keep in mind that ST7789 does not support 5V operation, so you need to make sure you use appropriate level shifters.
« Last Edit: October 11, 2023, 05:25:55 am by ataradov »
Alex
 

Offline DLXXVTopic starter

  • Newbie
  • Posts: 6
  • Country: us
    • Kosciusko Media
Re: ATSAM20C adding a display using MPLab Harmony
« Reply #2 on: October 11, 2023, 05:54:28 am »
I’m not worried about using the gfx tools with harmony. I just want a working display. I’ve never made a display driver though so I’m totally in the dark about where to start. There are some arduino drivers I can look at and rewrite but I don’t really know what to look for when writing it. As far as the ILI9488, what differences should I be looking at between the two? Memory management or clocks or something else?
Thanks
 

Offline DLXXVTopic starter

  • Newbie
  • Posts: 6
  • Country: us
    • Kosciusko Media
Re: ATSAM20C adding a display using MPLab Harmony
« Reply #3 on: October 11, 2023, 06:03:48 am »
Also, where is this generic driver? I couldn’t find anything like that at all. If so I could likely use the template to add 7789 functionality to it. Because when I read some I for from Microchip they said that the GLCD was the generic driver. Which is why I was looking for it
« Last Edit: October 11, 2023, 06:05:23 am by DLXXV »
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11261
  • Country: us
    • Personal site
Re: ATSAM20C adding a display using MPLab Harmony
« Reply #4 on: October 11, 2023, 06:06:21 am »
Read the datasheets for both, I don't know know all the differences. They will have different initialization procedures and register set, for sure. They may be very close. And even if the controllers are close, there may be differences in initialization values for a specific panel. But assuming it is just a random display from AliExpress, some generic values is the best you will get anyway.

But if you don't want Harmony gfx, then using Harmony drivers is not the most optimal thing anyway.

Take a generic Arduino driver and add the SPI interface from the Harmony driver.

I'll also attach my test code for this controller. The code is for SAM D11 and does not use anything Harmony. But the driver itself is universal.
Alex
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11261
  • Country: us
    • Personal site
Re: ATSAM20C adding a display using MPLab Harmony
« Reply #5 on: October 11, 2023, 06:09:36 am »
Also, where is this generic driver?
It should be somewhere in GFX components. No idea where, I don't have MPLAB or Harmony at home.

Look at the demo project I linked, it uses that generic driver.

GLCD was the generic driver
GLCD is generic for segment LCD displays. ST7789 is a TFT display, completely different thing.
Alex
 

Offline DLXXVTopic starter

  • Newbie
  • Posts: 6
  • Country: us
    • Kosciusko Media
Re: ATSAM20C adding a display using MPLab Harmony
« Reply #6 on: October 11, 2023, 06:32:06 am »
Thanks a lot for the help. I’ll have a look at the file and do some tests when I get home. And yeah, it’s a generic AliExpress display but I assume most ST7789 controllers are going to be similar
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11261
  • Country: us
    • Personal site
Re: ATSAM20C adding a display using MPLab Harmony
« Reply #7 on: October 11, 2023, 06:37:05 am »
I assume most ST7789 controllers are going to be similar
All ST7789 controllers are the same, but they are controlling a panel of pixels, and those are different. In the controller there are settings for all sorts of bias voltages and other things that are specific to the panel. Some generic version of those settings usually works, at worst it will shorten the life time of the panel a bit or will result in a sub-optimal picture quality.
Alex
 

Offline DLXXVTopic starter

  • Newbie
  • Posts: 6
  • Country: us
    • Kosciusko Media
Re: ATSAM20C adding a display using MPLab Harmony
« Reply #8 on: October 11, 2023, 07:15:10 am »
I see. That makes sense. Thanks for the info
 

Online dietert1

  • Super Contributor
  • ***
  • Posts: 2073
  • Country: br
    • CADT Homepage
Re: ATSAM20C adding a display using MPLab Harmony
« Reply #9 on: October 11, 2023, 12:43:43 pm »
Usually one finds demo software starting from the display product. The seller can help with a link to a zip archive. There should be ready to compile code to get a start. Of course you need to fit in the SPI transfer using a library for your MCU, but that's fast.

Regards, Dieter
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf