Matrix RGB Click Example Program

General discussion on mikroC PRO for PIC32.
Post Reply
Author
Message
Bill Legge
Posts: 235
Joined: 28 Oct 2007 03:16
Location: West Australia

Matrix RGB Click Example Program

#1 Post by Bill Legge » 01 Mar 2019 00:52

A year back, my RGB panels and Matrix RGB Click were working OK.
However, now I get nothing at all with:
1. Board is a EasyPICFusionv7.
2. MCU is a PIC32MX795F512L.
3. Panels are powered by a separate 5V supply.
4. The Matrix RGB Click is in mikroBUS Socket 1 on the left.
5. The IDC cable is the correct way round - little triangles match up.
6. Code is the example below - from Libstock re-downloaded yesterday.
Demo Code:

Code: Select all

#include "Click_Matrix_RGB_types.h"
#include "Click_Matrix_RGB_config.h"

#include "images.h"

void systemInit()
{
    mikrobus_gpioInit( _MIKROBUS1, _MIKROBUS_INT_PIN, _GPIO_INPUT );
    mikrobus_gpioInit( _MIKROBUS1, _MIKROBUS_CS_PIN, _GPIO_OUTPUT );
    mikrobus_gpioInit( _MIKROBUS1, _MIKROBUS_RST_PIN, _GPIO_OUTPUT );

    mikrobus_spiInit( _MIKROBUS1, &_MATRIXRGB_SPI_CFG[0] );

    Delay_ms( 100 );
}

void applicationInit()
{
    matrixrgb_spiDriverInit( (T_MATRIXRGB_P)&_MIKROBUS1_GPIO, (T_MATRIXRGB_P)&_MIKROBUS1_SPI );
    matrixrgb_deviceReset();

    matrixrgb_deviceInit( _MATRIXRGB_PATTERN_1_MAP_5MM );
    matrixrgb_setPower( 1 );
    Delay_ms( 1000 );

    // matrixrgb_setFont( &Arial9x9[0], 0xFFFF, _MATRIXRGB_FONT_HORIZONTAL );
    matrixrgb_fillScreen( 0xFFFF );
    Delay_ms( 1000 );
}

void applicationTask()
{
    uint16_t test;

    // Brightness Test
    for (test = 5; test < 50; test++)
    {
        matrixrgb_setBrightness( test );
        Delay_ms( 50 );
    }

    for (test = 50; test > 5; test--)
    {
        matrixrgb_setBrightness( test );
        Delay_ms( 50 );
    }

    // Pixel Write Test
    matrixrgb_fillScreen( 0x0000 );
    for (test = 0; test < 32; test++)
    {
        matrixrgb_writePixel( test, test, 0xF100 );
        Delay_ms( 100 );
    }
    for (test = 32; test > 0; test--)
    {
        matrixrgb_writePixel( 31 - test, test, 0xF100 );
        Delay_ms( 100 );
    }

    // Text Write Ttest
    // matrixrgb_fillScreen( 0x0000 );
    // matrixrgb_writeText( "RGB", 6, 5 );
    // matrixrgb_writeText( "Demo", 4, 20 );
    // Delay_ms( 2000 );

    // Image Test
    matrixrgb_drawImage( &mikroe_logo_32x32_bmp[0] );
    Delay_ms( 1000 );
}

void main()
{
    systemInit();
    applicationInit();

    while (1)
    {
        applicationTask();
    }
}
The code compiles OK and downloads to the board OK.
I have two Matrix RGB Clicks and neither produce anything.
My panel layout is 2X2 6mm so I have also tried the attribute: matrixrgb_deviceInit( _MATRIXRGB_PATTERN_4S_MAP_6MM );
I presume this is the correct one?
Any advice please to get me some working panels?
What is the format of the SPI sent to the Click Board - If I knew this I could do my own code without the Libstock 'special' functions.
I have just reloaded some 'old' code ( seems the functions have changed a bit in the new Libstock?) and the Matrix RGB Click work OK with this old code
but nothing works when I use the latest download - shown above.

Regards Bill Legge in Australia

User avatar
jovana.medakovic
mikroElektronika team
Posts: 986
Joined: 18 Dec 2018 10:36

Re: Matrix RGB Click Example Program

#2 Post by jovana.medakovic » 01 Mar 2019 11:37

Hello,

Can you tell me when was it you purchased Matrix RGB click and if you purchased the panel from us too or if it's your custom panel?
Can you send me a picture of how you connect panel with click board and with a power supply?

If I understood correctly, your click and panel work with the old code, do you mean this code:
https://libstock.mikroe.com/projects/vi ... r-versions
Can you send me a picture of your panel in this case, when it works?

Also, on our GitHub you can find the source code of this click board:
https://github.com/MikroElektronika/Matrix_RGB_click

Kind regards,
Jovana

Bill Legge
Posts: 235
Joined: 28 Oct 2007 03:16
Location: West Australia

Re: Matrix RGB Click Example Program

#3 Post by Bill Legge » 01 Mar 2019 23:21

Jovana - Thanks for your reply.
1. all parts purchased from MikroElektronika on Order PI-5861/17. invoice I-5342/17 dated 26.10.2017
Qty 4 MIKROE-2347 32X32 RGB LED Matrix Panel - 6mm Pitch.
Qty 2 MIKROE-2239 Matrix RGB Click.
Back of 32X32 panels have the manufacturers number P6-32X32-8S-V.
Power supply not puchased from you but high quality bench top Radio Spares Pro RPE4323 with 5V at 3A.
All worked OK about a year ago with 'old code' Libstock functions.
For example this 'old' code still works but will not compile with you new functions:

Code: Select all

    while(1){
        // Check is a frame has been received
        if(rxframe==1){
            rxframe = 0;
            // Clear the old pixels
            matrixrgb_clear_screen();
            // For each row
            for(row=0;row<64;row++){
                my_row = longlongrow[row];
                // Scan the columns and draw bit 0 at row 0 col63
                for(col=0;col<64;col++){
                    if(my_row&1)matrixrgb_write_pixel(row,col,0,1,0);
                    my_row>>= 1;
                }
            }
        }

        // 4 pixels for tractor position row 31, col 31
        matrixrgb_write_pixel(30,30,1,0,0);
        matrixrgb_write_pixel(30,32,1,0,0);
        matrixrgb_write_pixel(32,30,1,0,0);
        matrixrgb_write_pixel(32,32,1,0,0);
        matrixrgb_refresh();
    }
Notice that you have changed your Libstock functions since I wrote the code above. For example:
Old function matrixrgb_write_pixel(row,col,0,1,0); replaced by matrixrgb_writePixel(x,y,color);
Old function matrixrgb_init( width, height, panel_size ); replaced by matrixrgb_deviceInit(rowmap,pattern_id);
so my old code no longer compiles not will the Matrix RGB Clicks display the new functions.
I do not have the means to re-flash the Matrix RGB Clicks.
I can not find the format of the SPI frame that the Click needs - can you show me it's format please then I could write my own driver.
If necessary, I could post you the old Clicks to replace or re-flash?
Regards Bill Legge

Bill Legge
Posts: 235
Joined: 28 Oct 2007 03:16
Location: West Australia

Re: Matrix RGB Click Example Program

#4 Post by Bill Legge » 02 Mar 2019 00:47

OK - I have now got my old code and Matrix RGB Click running - using the 'Old Code'
that you gave me a reference to.
My mistake was to download the new Matrix RGB Click functions that do not work on the older Clicks.
How was I supposed to know this?
Please let me have the format of the SPI driver - I still can not find it on your website or in the Libstock code.

User avatar
jovana.medakovic
mikroElektronika team
Posts: 986
Joined: 18 Dec 2018 10:36

Re: Matrix RGB Click Example Program

#5 Post by jovana.medakovic » 04 Mar 2019 12:41

Hi,

You have a Matrix RGB click board with the old firmware version and because of that, you cannot use new Matrix RGB Click functions. You need to use the older version of the example.
If you want to use the mikroSDK example, you need to load new firmware using FT90x programmer.

Regarding SPI frame, if you open example, you can see that is used SPI3 with these parameters:
// SPI
SPI3_Init_Advanced( _SPI_MASTER,
_SPI_8_BIT,
2,
_SPI_SS_DISABLE,
_SPI_DATA_SAMPLE_END,
_SPI_CLK_IDLE_LOW,
_SPI_IDLE_2_ACTIVE );

Also, you can open the Click_MatrixRGB library in Library Manager and if you double click on some function, it will open Help file, where you can find an explanation of all functions.

Kind regards,
Jovana

Bill Legge
Posts: 235
Joined: 28 Oct 2007 03:16
Location: West Australia

Re: Matrix RGB Click Example Program

#6 Post by Bill Legge » 05 Mar 2019 00:33

Jovana, Thanks for your reply.
I presume the main difference between the new and old Matrix RGB Clicks is that the new ones
do not need a constant re-fresh by the driving MCU and they set the LED current using matrixRGB_SetBrigthness()?

I still cannot see, or find, the FRAME STRUCTURE; the details you sent are about the SPI attributes and, I agree, are easy to
see in the SDK/Libstock code. But, where are the details about the 'packets' ? what sequence of 8 Bits carries what data?

It's also less than helpful for there to be no mention of a 'Rev 2' Matrix RGB on your site - apart from a rather cryptic heading to 'new' and 'old' Libstock.
In many of your other products the new/improved items are clearly shown and differentiated.

Regards Bill Legge in Australia

User avatar
jovana.medakovic
mikroElektronika team
Posts: 986
Joined: 18 Dec 2018 10:36

Re: Matrix RGB Click Example Program

#7 Post by jovana.medakovic » 06 Mar 2019 14:18

Hello,

Matrix RGB click with the old firmware cannot be used with any panel. The new firmware addresses this issue.

Also, attached you can find the source code for the old firmware, so you can see how the FT900 parses the commands sent over SPI.

Kind regards,
Jovana
Attachments
Matrix_RGB_click-0274d74ef28826a3a2e0493d56d4aa19262bde09.zip
(1.76 MiB) Downloaded 110 times

Bill Legge
Posts: 235
Joined: 28 Oct 2007 03:16
Location: West Australia

Re: Matrix RGB Click Example Program

#8 Post by Bill Legge » 11 Mar 2019 01:48

I do not think I am making my point clearly:
1. I am often told than Libstock/SDK is wonderful and open source.
2. Where are the driver functions used in PIC32 to talk to the Matrix RGB Click?
3. I do not want the firmware that resides on the Click.
4. All I am asking for is some help in finding the code.

Regards Bill Legge in Australia

User avatar
jovana.medakovic
mikroElektronika team
Posts: 986
Joined: 18 Dec 2018 10:36

Re: Matrix RGB Click Example Program

#9 Post by jovana.medakovic » 11 Mar 2019 17:33

Hello,

I sent you in my first mail source code for Matrix RGB Click board:
https://github.com/MikroElektronika/Matrix_RGB_click

If you open a library folder, you can find __matrixrgb_driver.c file which contains the implementation of these functions.

Kind regards,
Jovana

Post Reply

Return to “mikroC PRO for PIC32 General”