Jump to content

Dolence

Members
  • Posts

    21
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by Dolence

  1. OK, so after testing the display in GPIO mode using an Arduino Mega and stating my display is fine I did some tests.

    I made a new STM32CUBEMX project using my board (nucleo-f746zg) with all the uneeded periperals left aside. I then set the FMC options reflecting my actual wiring:

    CS on NE1
    
    Memory Type: LCD Interface
    
    LCD Register Select: A16
    
    Data: 16 bits

    I have my display wired as this:

    ----- STM 32 ---------- SSD1963 ---- 
    PD6	LCD_RESET	/RESET
    PD4	FMC_NOE		E_RD
    PD5	FMC_NWE		R/W_WR
    PD7	FMC_NE1		/CS
    PD11	FMC_A16		D/C
    PD14	FMC_D0		DB0
    PD15	FMC_D1		DB1
    PD0	FMC_D2		DB2
    PD1	FMC_D3		DB4
    PE7	FMC_D4		DB4
    PE8	FMC_D5		DB5
    PE9	FMC_D6		DB6
    PE10	FMC_D7		DB7
    PE11	FMC_D8		DB8
    PE12	FMC_D9		DB9
    PE13	FMC_D10		DB10
    PE14	FMC_D11		DB11
    PE15	FMC_D12		DB12
    PD8	FMC_D13		DB13
    PD9	FMC_D14		DB14
    PD10	FMC_D15		DB15

    It's important to say that in NUCLEO board I had to desolder the bridges SB5/SB6  to be OFF and let SB4/SB7 in ON to be able to use USART3 pins as GPIO since they are tied to ST-LINK as default.

    nucleo.png.990dd469fe3c10ab7f403d8bd7e332a2.png

    Display initialization sequence is ripped from Arduino manufacturer example.

    I made a test to see if A16 state is being changed on DATA/CMD writes and it's working as expected.

    I have tried every FMC timing and mode I could find. Most of the time I got only a white background with thin static vertical colored lines. Some times it looks like it has been initilized but only portion of the screen is covered by a weird kahki background with some colored pixels sparkled over it.

    Suspecting it could be some kind of under powering issue (big display + backlight + nucleo board) I made a separete power 12V power source to nucleo board (over VIN) and 3.3V to display/backlight.

    I'm using very short arduino style jumper wires. It worked in slow bit banging mode on Mega example. I'm not sure the higher speed of STM32 is an issue since I saw people using long flat cables like those used in the old days IDE drives.

    I don't know what to try anymore. It's very hard to find a working example using FMC and STM32+SSD1963. I think F7 FMC have something different that I may be missing.

    I'm on this for days, no big progress so far. I know it's a community forum, most of you have been busy with your own tasks, but please, help me to figure this out. 

  2. Changed my nucleo to external 5V power, checked all the wiring lines one by one 3 times using an multimeter to be sure, tried to send init commands directly in a barebone fashion. Nothing produced any different result. I noticed my display has come with a 20mhz crystal instead a 10mhz as mentioned in gdisp_lld_SSD1963.c driver file PLL and SYS clock configurations, don't know if it could be the cause. I'm starting to suspect my display is defective.

  3. Ok, some updates...

    static void fmc_setup(void) {
      unsigned char FMC_Bank;
    
      rccEnableAHB3(RCC_AHB3ENR_FMCEN, 0);
    
      IOBus busD = {GPIOD, (1 << 0) | (1 << 1) | (1 << 4) | (1 << 5) | (1 << 7) | (1 << 8) |
                           (1 << 9) | (1 << 10) | (1 << 11) | (1 << 14) | (1 << 15), 0};
    
      IOBus busE = {GPIOE, (1 << 7) | (1 << 8) | (1 << 9) | (1 << 10) | (1 << 11) | (1 << 12) |
                           (1 << 13) | (1 << 14) | (1 << 15), 0};
    
      palSetBusMode(&busD, PAL_MODE_ALTERNATE(12));
      palSetBusMode(&busE, PAL_MODE_ALTERNATE(12));
    
      FMC_Bank = 0;
      FMC_Bank1->BTCR[FMC_Bank+1] = (FMC_BTR1_ADDSET_1 | FMC_BTR1_ADDSET_3) | \
                                    (FMC_BTR1_DATAST_1 | FMC_BTR1_DATAST_3) | \
                                    (FMC_BTR1_BUSTURN_1 | FMC_BTR1_BUSTURN_3);
    }
    
    
    int main(void) {
      halInit();
      chSysInit();
     
      fmc_setup();
    
      volatile uint16_t* fmc = (uint16_t*)0x60000000;
      volatile uint16_t w[] = { 0xFFFF, 0x0000, 0xFFFF, 0x0000, 0xFFFF, 0x0000, 0xFFFF, 0x0000};
      volatile uint8_t i = 0;
      volatile uint32_t j = 0;
    
      chThdSleepMilliseconds(500);
      while (true) {
    
        for(i = 0; i<8; i++) {
          fmc[j] = w[i];
          j++;
          if(j == 0x6fffffff) j =0;
        }
        chThdSleepMilliseconds(2);
      }
    }

    Wired a Logic Analyzer to FMC pins and the code above give the expected (I think) output of many sequences as the image below.

    lcd1.thumb.png.cbbaed5e996d3a8dcc02cf5eaceaaecd.png

    Next I moved to this code, ripped from the benchmark test:

    int main(void) {
    
      halInit();
      chSysInit();
    
        
        uint32_t i, pixels;
        coord_t height, width, rx, ry, rcx, rcy;
        volatile color_t random_color;
    
        chThdSleepMilliseconds(100);
    
        gfxInit();
    
        gdispSetOrientation(GDISP_ROTATE_90);
    
    
        width = gdispGetWidth();
        height = gdispGetHeight();
    
        pixels = 0;
    
    
        for (i = 0; i < 5000; i++) {
            random_color = (rand() % 65535);
            rx = (rand() % (width-10));
            ry = (rand() % (height-10));
            rcx = (rand() % ((width-rx)-10))+10;
            rcy = (rand() % ((height-ry)-10))+10;
    
            gdispFillArea(rx, ry, rcx, rcy, random_color);
            pixels += (rcx+1)*(rcy+1);
        }
    
         
    
        while(TRUE) {
    
            chThdSleepMilliseconds(100);
        }
    
    }

    No matter what, on LA the code output appears to hang right after gfxInit();

    This is the entire output, zoom maxed:

    lcd5.thumb.png.fd6ca23908771a1f9a85de1819908641.png

    And here in detail:

    lcd6.thumb.png.be74635364484a334fdf1154e7801200.png

    lcd7.thumb.png.e7ec90ecc4de63837ae102b982814c85.png

    Any thoughts on what could be the cause of the FMC output hanging after initialization?

     

    Thanks.

  4. Hi Joel. Thanks.

    I've changed optimization level to 0 in makefile and FMC increasing from 0x60000000 to 0x6fffffff. Main thread sleep time was reduced to 2 ms as well.

    Ok, now we've got some things happening!

    screenshot2.thumb.png.cb75cca2c1f7c4af8c301abe06d80b6e.png

    Look like A16 goes low while we output some juicy data to sub bank1.

    screenshot3.thumb.png.84605f645fac9fe161d6fcf63b0940bc.png

    And how it goes high when the address change to the next sub bank. I didn't understood that signal change sequence while going from low to high. Is it fine?

    screenshot4.thumb.png.8d809148ceb8845e77b0a27b8d4b67c4.png

    What should be the next step? Figure out timings? What about 6800 and 8080 modes thing? Please, just give me a north to follow and I will try to sort things out.

    Thanks.

  5. Ok, so following this board administrator advices I'm trying to isolate the problem. Started a project with nothing but FMC test code. I did it like this:

     

    #include "ch.h"
    #include "hal.h"
    //#include "gfx.h"
    
    
    
    static void fmc_setup(void) {
      unsigned char FMC_Bank;
    
      rccEnableAHB3(RCC_AHB3ENR_FMCEN, 0);
    
      IOBus busD = {GPIOD, (1 << 0) | (1 << 1) | (1 << 4) | (1 << 5) | (1 << 7) | (1 << 8) |
                           (1 << 9) | (1 << 10) | (1 << 11) | (1 << 14) | (1 << 15), 0};
    
      IOBus busE = {GPIOE, (1 << 7) | (1 << 8) | (1 << 9) | (1 << 10) | (1 << 11) | (1 << 12) |
                           (1 << 13) | (1 << 14) | (1 << 15), 0};
    
      palSetBusMode(&busD, PAL_MODE_ALTERNATE(12));
      palSetBusMode(&busE, PAL_MODE_ALTERNATE(12));
    
      FMC_Bank = 0;
      FMC_Bank1->BTCR[FMC_Bank+1] = (FMC_BTR1_ADDSET_1 | FMC_BTR1_ADDSET_3) | \
                                    (FMC_BTR1_DATAST_1 | FMC_BTR1_DATAST_3) | \
                                    (FMC_BTR1_BUSTURN_1 | FMC_BTR1_BUSTURN_3);
    }
    
    
    int main(void) {
      halInit();
      chSysInit();
    
      fmc_setup();
    
      volatile uint16_t* fmc = (uint16_t*)0x60000000;
      volatile uint16_t w[] = { 0xFFFF, 0x0000, 0xFFFF, 0x0000, 0xFFFF, 0x0000, 0xFFFF, 0x0000};
      volatile uint8_t i = 0;
    
      while (true) {
    
    
        for(i = 0; i<8; i++) {
          fmc[0] = w[i];
        }
        chThdSleepMilliseconds(50);
      }
    }

    And attached here is a capture from LA. I don't know why but it should be constantly streaming to FMC bus, instead the captured data are just those on the picture.

     

    screenshot.png

  6. Joel, thanks for helping and I'm sorry for taking your time. I now you are a very busy person and I really appreciate your attention.

    1 hour ago, Joel Bodenmann said:

    The SSD1963 has an R/S pin which is used to tell the display controller whether the incoming data is configuration data or actual pixel data. This is done so that you don't need to wire up all the address pins in order to address each pixel individually (and each configuration register). The two macros above are used to access the SSD1963's memory, one time with R/S set to 0 and one time set to 1 - essentially giving you the option to write pixel data or configuration using "stock FSMC" without having to manually control the R/S pin via a GPIO.
    You need to ensure that the macro which sets the R/S pin has the correct address. So if you hooked the R/S pin up to FSMC_A16 you need to sure that GDISP_RAM has address bit 16 (the 17th bit) set to 1.

    Knowing this, now I see the value 0x60020000 is wrong for FSMC_A16 since it would be a 1 on the 18th bit address bit 17. It should be 0x60010000.

    On 09/03/2018 at 13:17, Dolence said:

    /* set pins to FSMC mode */

    IOBus busD = {GPIOD, (1 << 0) | (1 << 1) | (1 << 4) | (1 << 5) | (1 << 7) | (1 << 8) | (1 << 9) | (1 << 10) | (1 << 11) | (1 << 14) | (1 << 15), 0};

    IOBus busE = {GPIOE, (1 << 7) | (1 << 8) | (1 << 9) | (1 << 10) | (1 << 11) | (1 << 12) | (1 << 13) | (1 << 14) | (1 << 15), 0};

    palSetBusMode(&busD, PAL_MODE_ALTERNATE(12));

    palSetBusMode(&busE, PAL_MODE_ALTERNATE(12));

    Unless I missed something, all the pins are correctly set, including Register Select which is PD11. I will triple-check this. I will do all the recommended tests using a scope and check timings in display datasheet, as suggested.

    I still have two things that I didn't get. 

    1) Looking at the struct from example board file above, it's missing 3 things. Mode, flipHorz and flipVert. Flip are pretty straight forward, but for mode I have all those options and I'm kind of lost on which should I be using.

    static const LCD_Parameters DisplayTimings[] = {
        // You need one of these array elements per display
        {
            800, 480,                               // Panel width and height
            2, 2, 41,                               // Horizontal Timings (back porch, front porch, pulse)
            CALC_PERIOD(800,2,2,41),                // Total Horizontal Period (calculated from above line)
            2, 2, 10,                               // Vertical Timings (back porch, front porch, pulse)
            CALC_PERIOD(480,2,2,10),                // Total Vertical Period (calculated from above line)
            CALC_FPR(800,480,2,2,41,2,2,10,60ULL)   // FPR - the 60ULL is the frames per second. Note the ULL!
        },
    };
    /* Set the pannel data width */
    		#define LCD_PANEL_DATA_WIDTH_24BIT 				(1<<5)						// 18bit default
    		/* Set the color deeph enhancement */
    		#define LCD_PANEL_ENABLE_FRC					((1<<3) | (1<<4))
    		#define LCD_PANEL_ENABLE_DITHERING				(1<<4)						// no enhancement default
    		/* Set the dot clock pulse polarity */
    		#define LCD_PANEL_LSHIFT_FALLING_EDGE			(1<<2)						// default rising edge
    		/* Set the horizontal sync pulse polarity */
    		#define LCD_PANEL_LLINE_ACTIVE_HIGH				(1<<1)						// default active low
    		/* Set the vertical sync pulse polarity */
    		#define LCD_PANEL_LFRAME_ACTIVE_HIGH			(1<0)						// default active low
    		/* Set the lcd panel mode */
    		#define LCD_PANEL_MODE_TTL						((1<<7) << 8)				// default mode is Hsync+Vsync +DE
    		/* Set the lcd panel interface type */										// default TFT mode
    		#define LCD_PANEL_TYPE_SERIAL_RGB_MODE			((1<<6) << 8)				// Serial RGB mode
    		#define LCD_PANEL_TYPE_SERIAL_RGB_DUMMY_MODE	(((1<<5) | (1<<6)) << 8)	// Serial RGB+dummy mode

    2) My display come from factory in 8080 parallel mode. I have no idea if the driver is expecting this or Motorola 6800. I don't even where it should be set. Would be it a STM32 FMC setting? Or it's implicit in the driver code? Maybe one of the previously mentioned mode macros? I also see an option for 24bit width, shouldn't it be a 16-bit option?

    Thank you very much. Any progress will be written here.

     

  7.  

    H! I've been trying to make this work without success so if anyone could help me I would be very glad.

    I'm trying to get this display working with my STM32F746ZG based nucleo144 board.

    Display is 800x480px 7" drived by SSD1963 in 16-bit 8080 parallel mode. I have Register Select at  A16/PD11.

    I don't know if the selected mode is wrong and how to change it or fi I have the FMC peripheral initialized properly. Anyone could please explain these lines to me? I can see from where 0x60000000 come from, but what about 0x60020000?

    #define GDISP_REG              (*((volatile uint16_t *) 0x60000000)) /* RS = 0 */
    #define GDISP_RAM              (*((volatile uint16_t *) 0x60020000)) /* RS = 1 */

     

    Attached is an image showing what happens. Basically, there is no image on display, only vertical lines in a white backgroud.

     

     

    My board file:

    /*
     * This file is subject to the terms of the GFX License. If a copy of
     * the license was not distributed with this file, you can obtain one at:
     *
     *              http://chibios-gfx.com/license.html
     */
    
    /**
     * @file    boards/addons/gdisp/board_SSD1963_fsmc.h
     * @brief   GDISP Graphic Driver subsystem board interface for the SSD1963 display.
     *
     * @note    This file contains a mix of hardware specific and operating system specific
     *          code. You will need to change it for your CPU and/or operating system.
     */
    
    #ifndef _GDISP_LLD_BOARD_H
    #define _GDISP_LLD_BOARD_H
    
    static const LCD_Parameters DisplayTimings[] = {
        // You need one of these array elements per display
        {
            800, 480,                               // Panel width and height
            2, 2, 41,                               // Horizontal Timings (back porch, front porch, pulse)
            CALC_PERIOD(800,2,2,41),                // Total Horizontal Period (calculated from above line)
            2, 2, 10,                               // Vertical Timings (back porch, front porch, pulse)
            CALC_PERIOD(480,2,2,10),                // Total Vertical Period (calculated from above line)
            CALC_FPR(800,480,2,2,41,2,2,10,60ULL)   // FPR - the 60ULL is the frames per second. Note the ULL!
        },
    };
    
    // For a multiple display configuration we would put all this in a structure and then
    //  set g->board to that structure.
    
    /* Using FSMC A16 as RS */
    #define GDISP_REG              (*((volatile uint16_t *) 0x60000000)) /* RS = 0 */
    #define GDISP_RAM              (*((volatile uint16_t *) 0x60020000)) /* RS = 1 */
    
    
    static GFXINLINE void init_board(GDisplay *g) {
    
        // As we are not using multiple displays we set g->board to NULL as we don't use it.
        g->board = 0;
    
        switch(g->controllerdisplay) {
        case 0:                                         // Set up for Display 0
            #if defined(STM32F1XX) || defined(STM32F3XX)
                /* FSMC setup for F1/F3 */
                rccEnableAHB(RCC_AHBENR_FSMCEN, 0);
            #elif defined(STM32F4XX) || defined(STM32F2XX)
                /* STM32F2-F4 FSMC init */
                rccEnableAHB3(RCC_AHB3ENR_FSMCEN, 0);
            #elif defined(STM32F7XX)
                rccEnableAHB3(RCC_AHB3ENR_FMCEN, 0);
            #else
                #error "FSMC not implemented for this device"
            #endif
    
            /* set pins to FSMC mode */
            IOBus busD = {GPIOD, (1 << 0) | (1 << 1) | (1 << 4) | (1 << 5) | (1 << 7) | (1 << 8) |
                                    (1 << 9) | (1 << 10) | (1 << 11) | (1 << 14) | (1 << 15), 0};
    
            IOBus busE = {GPIOE, (1 << 7) | (1 << 8) | (1 << 9) | (1 << 10) | (1 << 11) | (1 << 12) |
                                (1 << 13) | (1 << 14) | (1 << 15), 0};
    
            palSetBusMode(&busD, PAL_MODE_ALTERNATE(12));
            palSetBusMode(&busE, PAL_MODE_ALTERNATE(12));
    
            /* FSMC timing */
            FMC_Bank1->BTCR[0+1] = (FMC_BTR1_ADDSET_1 | FMC_BTR1_ADDSET_3) \
                | (FMC_BTR1_DATAST_1 | FMC_BTR1_DATAST_3) \
                | (FMC_BTR1_BUSTURN_1 | FMC_BTR1_BUSTURN_3) ;
            /*
            FSMC_Bank1->BTCR[0+1] = (FSMC_BTR1_ADDSET_1 | FSMC_BTR1_ADDSET_3) \
                    | (FSMC_BTR1_DATAST_1 | FSMC_BTR1_DATAST_3) \
                    | (FSMC_BTR1_BUSTURN_1 | FSMC_BTR1_BUSTURN_3) ;
            */
            /* Bank1 NOR/SRAM control register configuration
             * This is actually not needed as already set by default after reset */
            //FSMC_Bank1->BTCR[0] = FSMC_BCR1_MWID_0 | FSMC_BCR1_WREN | FSMC_BCR1_MBKEN;
            break;
        }
    }
    
    static GFXINLINE void post_init_board(GDisplay *g) {
        (void) g;
        /* FSMC delay reduced as the controller now runs at full speed */
        FMC_Bank1->BTCR[0+1] = FMC_BTR1_ADDSET_0 | FMC_BTR1_DATAST_2 | FMC_BTR1_BUSTURN_0 ;
        FMC_Bank1->BTCR[0] = FMC_BCR1_MWID_0 | FMC_BCR1_WREN | FMC_BCR1_MBKEN;
        //FSMC_Bank1->BTCR[0+1] = FSMC_BTR1_ADDSET_0 | FSMC_BTR1_DATAST_2 | FSMC_BTR1_BUSTURN_0 ;
        //FSMC_Bank1->BTCR[0] = FSMC_BCR1_MWID_0 | FSMC_BCR1_WREN | FSMC_BCR1_MBKEN;
    }
    
    static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) {
        (void) g;
        (void) state;
    }
    
    static GFXINLINE void acquire_bus(GDisplay *g) {
        (void) g;
    }
    
    static GFXINLINE void release_bus(GDisplay *g) {
        (void) g;
    }
    
    static GFXINLINE void write_index(GDisplay *g, uint16_t index) {
        (void) g;
        GDISP_REG = index;
    }
    
    static GFXINLINE void write_data(GDisplay *g, uint16_t data) {
        (void) g;
        GDISP_RAM = data;
    }
    
    #endif /* _GDISP_LLD_BOARD_H */

     

     

    Thanks in advance.

    JwKekS1[1].jpg

  8. Hi cpu20! Thanks for your reply.

    I've been doing my homework in the past few days. With my current setup I can't even display gifs and pngs.

    Looking into the drivers, SSD ones appears to already have hardware acceleration implemented. RA8875 have more hardware acceleration options but almost none of them are present on driver. I don't know how easy would be to a newbie guy like me implement those functions. I will take a look on how it was done on another driver.

    The MCU I was planning to use was an STM32F4 with192 kB ram and 1 MB flash. For image storage, is possible to hook another device to fsmc bus?

    Thank you.

  9. Hi!

    I'm basically an AVR 8-bit withou much experience with real time OSes. Recently I've been learning ChibiOS and STM32 microcontrollers. Using uGFX I was able to properly drive an small and very slow 2.2" ILI9341 SPI display. I want to buy a bigger and faster display for use in a future project. I will probably pick an FSMC capable STM32, unless  someone say LTDC would be a better option.

     

    Actually I have considered these options:

     

    9 in

    1) 9 inch LCD Module TFT Display w/OPTL Touch Panel,I2C+Serial SPI

    2) 9"TFT LCD Module Touch Display w/SSD1963 Controller Board for Arduino

     

    10.1 in

    3) Serial SPI I2C 10.1"TFT LCD Module Dislay w/RA8876,OPTL Touch Panel

     

    Between 1 and 2 (RA8875 and SSD1963) which one would be faster and better supported by uGFX considering they would be wired to 16-bit FSMC interface? By the controllers datasheet RA8875 apparently  have more hardware acceleration options. 

    Option 3 seens to be slightly different from RA8875. How difficult would be to get it working with uGFX and what are the benefits (beside increased screen size and resolution)?

     

    If you have any other suggestion, I would be glad to hear it!

     

    Thanks in advance!

     

  10. Hi Tectu! Thanks for your valuable support!

    I spent some time following your advices but still no joy. What I did so far was test board file following board_SSD1306_spi.h as base template and lastly this one http://forum.ugfx.org/viewtopic.php?f=23&t=175&start=30#p1411

    Actually my board file looks like this:

    /*
    * This file is subject to the terms of the GFX License. If a copy of
    * the license was not distributed with this file, you can obtain one at:
    *
    * http://ugfx.org/license.html
    */

    /**
    * @file boards/addons/gdisp/board_ILI9341_spi.h
    * @brief GDISP Graphic Driver subsystem board interface for the ILI9341 display.
    *
    * @note This file contains a mix of hardware specific and operating system specific
    * code. You will need to change it for your CPU and/or operating system.
    */

    #ifndef _GDISP_LLD_BOARD_H
    #define _GDISP_LLD_BOARD_H
    #include "ch.h"

    #define SPI_METHOD_IRQ 1
    #define SPI_METHOD_POLLING 2
    #define SPI_METHOD SPI_METHOD_POLLING

    #define SPI_PORT (&SPID1)
    #define LCD_PORT GPIOA
    #define LCD_MOSI 7
    #define LCD_MISO 6
    #define LCD_SCK 5
    #define LCD_CS 4
    #define LCD_DC 2
    #define LCD_RES 3




    /**
    * SPI configuration structure.
    * Speed 12 MHz, CPHA=0, CPOL=0, 8bits frames, MSb transmitted first.
    * Soft slave select.
    */
    static const SPIConfig spi1cfg = {
    NULL,
    LCD_PORT,
    LCD_CS,
    //0
    SPI_CR1_BR_2 | SPI_CR1_BR_1
    };



    static __inline void init_board(GDisplay *g) {
    (void) g;

    // As we are not using multiple displays we set g->board to NULL as we don't use it.
    g->board = 0;

    //setup pins
    palSetPadMode(LCD_PORT, LCD_CS, PAL_MODE_OUTPUT_PUSHPULL); // CS
    palSetPadMode(LCD_PORT, LCD_SCK, PAL_MODE_STM32_ALTERNATE_PUSHPULL); // SCK
    palSetPadMode(LCD_PORT, LCD_MISO, PAL_MODE_STM32_ALTERNATE_PUSHPULL); // MISO
    palSetPadMode(LCD_PORT, LCD_MOSI, PAL_MODE_STM32_ALTERNATE_PUSHPULL); // MOSI

    palSetPadMode(LCD_PORT, LCD_RES, PAL_MODE_OUTPUT_PUSHPULL); // RESET
    palSetPadMode(LCD_PORT, LCD_DC, PAL_MODE_OUTPUT_PUSHPULL); // DC

    //set pins
    palSetPad(LCD_PORT, LCD_CS);
    palSetPad(LCD_PORT, LCD_RES);
    palClearPad(LCD_PORT, LCD_DC);

    //spiInit();
    spiStart(SPI_PORT, &spi1cfg);
    spiSelect(SPI_PORT);
    }


    static __inline void post_init_board(GDisplay *g) {
    (void) g;
    }

    static __inline void setpin_reset(GDisplay *g, bool_t state) {
    (void) g;
    palWritePad(LCD_PORT, LCD_RES, !state);
    }

    static __inline void acquire_bus(GDisplay *g) {
    (void) g;
    spiSelect(SPI_PORT);
    }


    static __inline void release_bus(GDisplay *g) {
    (void) g;
    spiUnselect(SPI_PORT);
    }

    static __inline void set_backlight(GDisplay *g, uint8_t percent) {
    (void) g;
    (void) percent;
    }


    static __inline void write_index(GDisplay *g, uint8_t index) {
    (void) g;
    palClearPad(LCD_PORT, LCD_DC);
    #if SPI_METHOD == SPI_METHOD_IRQ
    spiSend(SPI_PORT, 1, &index);
    #elif SPI_METHOD == SPI_METHOD_POLLING
    spiPolledExchange(SPI_PORT, index);
    #endif
    palSetPad(LCD_PORT, LCD_DC);
    }

    //static GFXINLINE void write_data(GDisplay *g, uint8_t* data, uint16_t length) {
    static __inline void write_data(GDisplay *g, uint8_t data) {
    (void) g;
    #if SPI_METHOD == SPI_METHOD_IRQ
    spiSend(SPI_PORT, 1, &data);
    #elif SPI_METHOD == SPI_METHOD_POLLING
    spiPolledExchange(SPI_PORT, data);
    #endif
    }


    static __inline void setreadmode(GDisplay *g) {
    (void) g;
    }

    static __inline void setwritemode(GDisplay *g) {
    (void) g;
    }

    static __inline uint16_t read_data(GDisplay *g) {
    (void) g;
    return 0;
    }

    #endif /* _GDISP_LLD_BOARD_H */

    No errors during compiling, but 4 warnings are listed:


    "GDISP_PIXELFORMAT_CUSTOM" is not defined [-Wundef] gdisp_driver.h /WDR-STM32F1xx-SPI/ugfx/src/gdisp line 293 C/C++ Problem
    "GFX_EMULATE_MALLOC" is not defined [-Wundef] gos_rules.h /WDR-STM32F1xx-SPI/ugfx/src/gos line 31 C/C++ Problem
    "GMISC_NEED_MATRIXFIXED2D" is not defined [-Wundef] gmisc.h /WDR-STM32F1xx-SPI/ugfx/src/gmisc line 347 C/C++ Problem
    "GMISC_NEED_MATRIXFLOAT2D" is not defined [-Wundef] gmisc.h /WDR-STM32F1xx-SPI/ugfx/src/gmisc line 229 C/C++ Problem

    Make sure that your SPI pins are initialized properly. It's a good manner to initialize ALL pins in the board_init() function. So do the same as you did for the Reset, CS and DS pins for the MOSI, MISO and SCK pins.

    static inline void init_board(GDisplay *g) {
    (void) g;

    // As we are not using multiple displays we set g->board to NULL as we don't use it.
    g->board = 0;

    //setup pins
    palSetPadMode(LCD_PORT, LCD_CS, PAL_MODE_OUTPUT_PUSHPULL); // CS
    palSetPadMode(LCD_PORT, LCD_SCK, PAL_MODE_STM32_ALTERNATE_PUSHPULL); // SCK
    palSetPadMode(LCD_PORT, LCD_MISO, PAL_MODE_STM32_ALTERNATE_PUSHPULL); // MISO
    palSetPadMode(LCD_PORT, LCD_MOSI, PAL_MODE_STM32_ALTERNATE_PUSHPULL); // MOSI

    palSetPadMode(LCD_PORT, LCD_RES, PAL_MODE_OUTPUT_PUSHPULL); // RESET
    palSetPadMode(LCD_PORT, LCD_DC, PAL_MODE_OUTPUT_PUSHPULL); // DC

    //set pins
    palSetPad(LCD_PORT, LCD_CS);
    palSetPad(LCD_PORT, LCD_RES);
    palClearPad(LCD_PORT, LCD_DC);

    //spiInit();
    spiStart(SPI_PORT, &spi1cfg);
    spiSelect(SPI_PORT);
    }

    Use the ChibiOS/HAL API for handling the SPI. Currently you are manually accessing some of the SPI registers which is NOT recommended when working with ChibiOS. You can find plenty of examples on how to use the ChibiOS/HAL API to interface an SPI client in the various ChibiOS examples, demos and testhal as well as for some other displays and touchscreens in the uGFX boards directory. Make sure that you use spiSelect() as well as spiUnselect() inside the acquire_bus() and release_bus() functions. Use the synchronous API (spiSend() if I remember correctly) to send the actual data.

    static inline void acquire_bus(GDisplay *g) {
    (void) g;
    spiSelect(SPI_PORT);

    }


    static inline void release_bus(GDisplay *g) {
    (void) g;
    spiUnselect(SPI_PORT);
    }

    Check your SPI modes. Make sure that the clock polarity etc. is set properly. Your ChibiOS/HAL SPI config struct seems a bit odd. Usually the ILI9341 should work with all default settings. Just limit the clock speed but don't touch the SSE, SSI and so on (I might be wrong here).

    static const SPIConfig spi1cfg = {
    NULL,
    LCD_PORT,
    LCD_CS,
    0
    //SPI_CR1_BR_2 | SPI_CR1_BR_1
    };

    Check the SPI signals with an oscilloscope or a logic analyzer.

    6fCYmDxh.jpg

    Lastly: We have had multiple issues with the ILI93xx drivers where a supplier claimed that it's one display but in fact it was another one. While commonly this usually happens with the ILI9325 vs. ILI9320 we have seen the same with the ILI9341. If none of the above fixed your issue I'd recommend trying all the other ILI93xx drivers. This should be very straight forward as the board files for all those drivers are exactly the same.

    Didn't tried this, but since I've already got it working using stm32duino ILI9341 drivers it should rule out this possibility.

    What else could I do? Any suggestions? Thank you again :)

  11. Here is the complete source: https://mega.nz/#!IM9SyYbD

    Complete build console output:

    In file included from ./ugfx/src/gwin/../../gfx.h:186:0,
    from ./ugfx/src/gwin/gwin_keyboard.c:13:
    ./ugfx/src/gwin/../../src/gos/gos_rules.h:31:5: warning: "GFX_EMULATE_MALLOC" is not defined [-Wundef]
    #if GFX_EMULATE_MALLOC
    ^
    In file included from ./ugfx/src/gwin/../../gfx.h:194:0,
    from ./ugfx/src/gwin/gwin_gl3d.c:13:
    ./ugfx/src/gwin/../../src/gmisc/gmisc.h:229:5: warning: "GMISC_NEED_MATRIXFLOAT2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFLOAT2D || defined(__DOXYGEN__)
    ^
    In file included from ./ugfx/src/gwin/../../gfx.h:194:0,
    from ./ugfx/src/gwin/gwin_tabset.c:13:
    ./ugfx/src/gwin/../../src/gmisc/gmisc.h:229:5: warning: "GMISC_NEED_MATRIXFLOAT2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFLOAT2D || defined(__DOXYGEN__)
    ^
    ./ugfx/src/gwin/../../src/gmisc/gmisc.h:347:5: warning: "GMISC_NEED_MATRIXFIXED2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFIXED2D || defined(__DOXYGEN__)
    ^
    ./ugfx/src/gwin/../../src/gmisc/gmisc.h:347:5: warning: "GMISC_NEED_MATRIXFIXED2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFIXED2D || defined(__DOXYGEN__)
    ^
    In file included from ./ugfx/src/gwin/../../gfx.h:194:0,
    from ./ugfx/src/gwin/gwin_keyboard.c:13:
    ./ugfx/src/gwin/../../src/gmisc/gmisc.h:229:5: warning: "GMISC_NEED_MATRIXFLOAT2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFLOAT2D || defined(__DOXYGEN__)
    ^
    ./ugfx/src/gwin/../../src/gmisc/gmisc.h:347:5: warning: "GMISC_NEED_MATRIXFIXED2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFIXED2D || defined(__DOXYGEN__)
    ^
    In file included from ./ugfx/src/gwin/../../gfx.h:186:0,
    from ./ugfx/src/gwin/gwin_keyboard_layout.c:8:
    ./ugfx/src/gwin/../../src/gos/gos_rules.h:31:5: warning: "GFX_EMULATE_MALLOC" is not defined [-Wundef]
    #if GFX_EMULATE_MALLOC
    ^
    Compiling gwin_textedit.c
    Compiling ginput.c
    In file included from ./ugfx/src/gwin/../../gfx.h:194:0,
    from ./ugfx/src/gwin/gwin_keyboard_layout.c:8:
    ./ugfx/src/gwin/../../src/gmisc/gmisc.h:229:5: warning: "GMISC_NEED_MATRIXFLOAT2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFLOAT2D || defined(__DOXYGEN__)
    ^
    ./ugfx/src/gwin/../../src/gmisc/gmisc.h:347:5: warning: "GMISC_NEED_MATRIXFIXED2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFIXED2D || defined(__DOXYGEN__)
    ^
    Compiling ginput_mouse.c
    Compiling ginput_keyboard.c
    Compiling ginput_keyboard_microcode.c
    In file included from ./ugfx/src/gwin/../../gfx.h:186:0,
    from ./ugfx/src/gwin/gwin_textedit.c:13:
    ./ugfx/src/gwin/../../src/gos/gos_rules.h:31:5: warning: "GFX_EMULATE_MALLOC" is not defined [-Wundef]
    #if GFX_EMULATE_MALLOC
    ^
    In file included from ./ugfx/src/ginput/../../gfx.h:186:0,
    from ./ugfx/src/ginput/ginput.c:15:
    ./ugfx/src/ginput/../../src/gos/gos_rules.h:31:5: warning: "GFX_EMULATE_MALLOC" is not defined [-Wundef]
    Compiling ginput_toggle.c
    #if GFX_EMULATE_MALLOC
    ^
    In file included from ./ugfx/src/ginput/../../gfx.h:186:0,
    from ./ugfx/src/ginput/ginput_mouse.c:12:
    ./ugfx/src/ginput/../../src/gos/gos_rules.h:31:5: warning: "GFX_EMULATE_MALLOC" is not defined [-Wundef]
    #if GFX_EMULATE_MALLOC
    ^
    In file included from ./ugfx/src/ginput/../../gfx.h:186:0,
    from ./ugfx/src/ginput/ginput_keyboard_microcode.c:13:
    ./ugfx/src/ginput/../../src/gos/gos_rules.h:31:5: warning: "GFX_EMULATE_MALLOC" is not defined [-Wundef]
    #if GFX_EMULATE_MALLOC
    ^
    In file included from ./ugfx/src/ginput/../../gfx.h:186:0,
    from ./ugfx/src/ginput/ginput_keyboard.c:16:
    ./ugfx/src/ginput/../../src/gos/gos_rules.h:31:5: warning: "GFX_EMULATE_MALLOC" is not defined [-Wundef]
    #if GFX_EMULATE_MALLOC
    ^
    In file included from ./ugfx/src/gwin/../../gfx.h:194:0,
    from ./ugfx/src/gwin/gwin_textedit.c:13:
    ./ugfx/src/gwin/../../src/gmisc/gmisc.h:229:5: warning: "GMISC_NEED_MATRIXFLOAT2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFLOAT2D || defined(__DOXYGEN__)
    ^
    ./ugfx/src/gwin/../../src/gmisc/gmisc.h:347:5: warning: "GMISC_NEED_MATRIXFIXED2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFIXED2D || defined(__DOXYGEN__)
    ^
    In file included from ./ugfx/src/ginput/../../gfx.h:194:0,
    from ./ugfx/src/ginput/ginput_mouse.c:12:
    ./ugfx/src/ginput/../../src/gmisc/gmisc.h:229:5: warning: "GMISC_NEED_MATRIXFLOAT2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFLOAT2D || defined(__DOXYGEN__)
    ^
    ./ugfx/src/ginput/../../src/gmisc/gmisc.h:347:5: warning: "GMISC_NEED_MATRIXFIXED2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFIXED2D || defined(__DOXYGEN__)
    ^
    In file included from ./ugfx/src/ginput/../../gfx.h:194:0,
    from ./ugfx/src/ginput/ginput.c:15:
    ./ugfx/src/ginput/../../src/gmisc/gmisc.h:229:5: warning: "GMISC_NEED_MATRIXFLOAT2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFLOAT2D || defined(__DOXYGEN__)
    ^
    ./ugfx/src/ginput/../../src/gmisc/gmisc.h:347:5: warning: "GMISC_NEED_MATRIXFIXED2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFIXED2D || defined(__DOXYGEN__)
    ^
    In file included from ./ugfx/src/ginput/../../gfx.h:194:0,
    from ./ugfx/src/ginput/ginput_keyboard_microcode.c:13:
    ./ugfx/src/ginput/../../src/gmisc/gmisc.h:229:5: warning: "GMISC_NEED_MATRIXFLOAT2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFLOAT2D || defined(__DOXYGEN__)
    ^
    ./ugfx/src/ginput/../../src/gmisc/gmisc.h:347:5: warning: "GMISC_NEED_MATRIXFIXED2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFIXED2D || defined(__DOXYGEN__)
    ^
    In file included from ./ugfx/src/ginput/../../gfx.h:194:0,
    from ./ugfx/src/ginput/ginput_keyboard.c:16:
    ./ugfx/src/ginput/../../src/gmisc/gmisc.h:229:5: warning: "GMISC_NEED_MATRIXFLOAT2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFLOAT2D || defined(__DOXYGEN__)
    ^
    ./ugfx/src/ginput/../../src/gmisc/gmisc.h:347:5: warning: "GMISC_NEED_MATRIXFIXED2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFIXED2D || defined(__DOXYGEN__)
    ^
    In file included from ./ugfx/src/ginput/../../gfx.h:186:0,
    from ./ugfx/src/ginput/ginput_toggle.c:16:
    ./ugfx/src/ginput/../../src/gos/gos_rules.h:31:5: warning: "GFX_EMULATE_MALLOC" is not defined [-Wundef]
    #if GFX_EMULATE_MALLOC
    ^
    Compiling gadc.c
    Compiling gaudio.c
    Compiling ginput_dial.c
    Compiling gmisc.c
    In file included from ./ugfx/src/ginput/../../gfx.h:194:0,
    from ./ugfx/src/ginput/ginput_toggle.c:16:
    ./ugfx/src/ginput/../../src/gmisc/gmisc.h:229:5: warning: "GMISC_NEED_MATRIXFLOAT2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFLOAT2D || defined(__DOXYGEN__)
    ^
    ./ugfx/src/ginput/../../src/gmisc/gmisc.h:347:5: warning: "GMISC_NEED_MATRIXFIXED2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFIXED2D || defined(__DOXYGEN__)
    ^
    Compiling gmisc_arrayops.c
    In file included from ./ugfx/src/gadc/../../gfx.h:186:0,
    from ./ugfx/src/gadc/gadc.c:8:
    ./ugfx/src/gadc/../../src/gos/gos_rules.h:31:5: warning: "GFX_EMULATE_MALLOC" is not defined [-Wundef]
    #if GFX_EMULATE_MALLOC
    ^
    In file included from ./ugfx/src/gaudio/../../gfx.h:186:0,
    from ./ugfx/src/gaudio/gaudio.c:8:
    ./ugfx/src/gaudio/../../src/gos/gos_rules.h:31:5: warning: "GFX_EMULATE_MALLOC" is not defined [-Wundef]
    #if GFX_EMULATE_MALLOC
    ^
    In file included from ./ugfx/src/ginput/../../gfx.h:186:0,
    from ./ugfx/src/ginput/ginput_dial.c:16:
    ./ugfx/src/ginput/../../src/gos/gos_rules.h:31:5: warning: "GFX_EMULATE_MALLOC" is not defined [-Wundef]
    #if GFX_EMULATE_MALLOC
    ^
    In file included from ./ugfx/src/gmisc/../../gfx.h:186:0,
    from ./ugfx/src/gmisc/gmisc.c:8:
    ./ugfx/src/gmisc/../../src/gos/gos_rules.h:31:5: warning: "GFX_EMULATE_MALLOC" is not defined [-Wundef]
    #if GFX_EMULATE_MALLOC
    ^
    In file included from ./ugfx/src/gmisc/../../gfx.h:186:0,
    from ./ugfx/src/gmisc/gmisc_arrayops.c:8:
    ./ugfx/src/gmisc/../../src/gos/gos_rules.h:31:5: warning: "GFX_EMULATE_MALLOC" is not defined [-Wundef]
    #if GFX_EMULATE_MALLOC
    ^
    In file included from ./ugfx/src/gadc/../../gfx.h:194:0,
    from ./ugfx/src/gadc/gadc.c:8:
    ./ugfx/src/gadc/../../src/gmisc/gmisc.h:229:5: warning: "GMISC_NEED_MATRIXFLOAT2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFLOAT2D || defined(__DOXYGEN__)
    ^
    ./ugfx/src/gadc/../../src/gmisc/gmisc.h:347:5: warning: "GMISC_NEED_MATRIXFIXED2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFIXED2D || defined(__DOXYGEN__)
    ^
    In file included from ./ugfx/src/ginput/../../gfx.h:194:0,
    from ./ugfx/src/ginput/ginput_dial.c:16:
    ./ugfx/src/ginput/../../src/gmisc/gmisc.h:229:5: warning: "GMISC_NEED_MATRIXFLOAT2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFLOAT2D || defined(__DOXYGEN__)
    ^
    ./ugfx/src/ginput/../../src/gmisc/gmisc.h:347:5: warning: "GMISC_NEED_MATRIXFIXED2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFIXED2D || defined(__DOXYGEN__)
    ^
    In file included from ./ugfx/src/gaudio/../../gfx.h:194:0,
    from ./ugfx/src/gaudio/gaudio.c:8:
    ./ugfx/src/gaudio/../../src/gmisc/gmisc.h:229:5: warning: "GMISC_NEED_MATRIXFLOAT2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFLOAT2D || defined(__DOXYGEN__)
    ^
    ./ugfx/src/gaudio/../../src/gmisc/gmisc.h:347:5: warning: "GMISC_NEED_MATRIXFIXED2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFIXED2D || defined(__DOXYGEN__)
    ^
    Compiling gmisc_matrix2d.c
    In file included from ./ugfx/src/gmisc/../../gfx.h:194:0,
    from ./ugfx/src/gmisc/gmisc.c:8:
    ./ugfx/src/gmisc/../../src/gmisc/gmisc.h:229:5: warning: "GMISC_NEED_MATRIXFLOAT2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFLOAT2D || defined(__DOXYGEN__)
    ^
    ./ugfx/src/gmisc/../../src/gmisc/gmisc.h:347:5: warning: "GMISC_NEED_MATRIXFIXED2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFIXED2D || defined(__DOXYGEN__)
    ^
    In file included from ./ugfx/src/gmisc/../../gfx.h:194:0,
    from ./ugfx/src/gmisc/gmisc_arrayops.c:8:
    ./ugfx/src/gmisc/../../src/gmisc/gmisc.h:229:5: warning: "GMISC_NEED_MATRIXFLOAT2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFLOAT2D || defined(__DOXYGEN__)
    ^
    ./ugfx/src/gmisc/../../src/gmisc/gmisc.h:347:5: warning: "GMISC_NEED_MATRIXFIXED2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFIXED2D || defined(__DOXYGEN__)
    ^
    Compiling gmisc_trig.c
    Compiling gfile_fs_native.c
    Compiling gfile.c
    In file included from ./ugfx/src/gmisc/../../gfx.h:186:0,
    from ./ugfx/src/gmisc/gmisc_matrix2d.c:8:
    ./ugfx/src/gmisc/../../src/gos/gos_rules.h:31:5: warning: "GFX_EMULATE_MALLOC" is not defined [-Wundef]
    #if GFX_EMULATE_MALLOC
    ^
    Compiling gfile_fs_ram.c
    Compiling gfile_fs_rom.c
    In file included from ./ugfx/src/gmisc/../../gfx.h:186:0,
    from ./ugfx/src/gmisc/gmisc_trig.c:8:
    ./ugfx/src/gmisc/../../src/gos/gos_rules.h:31:5: warning: "GFX_EMULATE_MALLOC" is not defined [-Wundef]
    #if GFX_EMULATE_MALLOC
    ^
    In file included from ./ugfx/src/gmisc/../../gfx.h:194:0,
    from ./ugfx/src/gmisc/gmisc_matrix2d.c:8:
    ./ugfx/src/gmisc/../../src/gmisc/gmisc.h:229:5: warning: "GMISC_NEED_MATRIXFLOAT2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFLOAT2D || defined(__DOXYGEN__)
    ^
    ./ugfx/src/gmisc/../../src/gmisc/gmisc.h:347:5: warning: "GMISC_NEED_MATRIXFIXED2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFIXED2D || defined(__DOXYGEN__)
    ^
    In file included from ./ugfx/src/gfile/../../gfx.h:186:0,
    from ./ugfx/src/gfile/gfile.c:8:
    ./ugfx/src/gfile/../../src/gos/gos_rules.h:31:5: warning: "GFX_EMULATE_MALLOC" is not defined [-Wundef]
    #if GFX_EMULATE_MALLOC
    ^
    In file included from ./ugfx/src/gfile/../../gfx.h:186:0,
    from ./ugfx/src/gfile/gfile_fs_native.c:15:
    ./ugfx/src/gfile/../../src/gos/gos_rules.h:31:5: warning: "GFX_EMULATE_MALLOC" is not defined [-Wundef]
    #if GFX_EMULATE_MALLOC
    ^
    ./ugfx/src/gmisc/gmisc_matrix2d.c:12:5: warning: "GMISC_NEED_MATRIXFLOAT2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFLOAT2D
    ^
    ./ugfx/src/gmisc/gmisc_matrix2d.c:106:5: warning: "GMISC_NEED_MATRIXFIXED2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFIXED2D
    ^
    In file included from ./ugfx/src/gfile/../../gfx.h:186:0,
    from ./ugfx/src/gfile/gfile_fs_ram.c:12:
    ./ugfx/src/gfile/../../src/gos/gos_rules.h:31:5: warning: "GFX_EMULATE_MALLOC" is not defined [-Wundef]
    #if GFX_EMULATE_MALLOC
    ^
    In file included from ./ugfx/src/gmisc/../../gfx.h:194:0,
    from ./ugfx/src/gmisc/gmisc_trig.c:8:
    ./ugfx/src/gmisc/../../src/gmisc/gmisc.h:229:5: warning: "GMISC_NEED_MATRIXFLOAT2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFLOAT2D || defined(__DOXYGEN__)
    ^
    ./ugfx/src/gmisc/../../src/gmisc/gmisc.h:347:5: warning: "GMISC_NEED_MATRIXFIXED2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFIXED2D || defined(__DOXYGEN__)
    ^
    In file included from ./ugfx/src/gfile/../../gfx.h:194:0,
    from ./ugfx/src/gfile/gfile_fs_native.c:15:
    ./ugfx/src/gfile/../../src/gmisc/gmisc.h:229:5: warning: "GMISC_NEED_MATRIXFLOAT2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFLOAT2D || defined(__DOXYGEN__)
    ^
    ./ugfx/src/gfile/../../src/gmisc/gmisc.h:347:5: warning: "GMISC_NEED_MATRIXFIXED2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFIXED2D || defined(__DOXYGEN__)
    ^
    In file included from ./ugfx/src/gfile/../../gfx.h:194:0,
    from ./ugfx/src/gfile/gfile.c:8:
    ./ugfx/src/gfile/../../src/gmisc/gmisc.h:229:5: warning: "GMISC_NEED_MATRIXFLOAT2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFLOAT2D || defined(__DOXYGEN__)
    ^
    ./ugfx/src/gfile/../../src/gmisc/gmisc.h:347:5: warning: "GMISC_NEED_MATRIXFIXED2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFIXED2D || defined(__DOXYGEN__)
    ^
    In file included from ./ugfx/src/gfile/../../gfx.h:186:0,
    from ./ugfx/src/gfile/gfile_fs_rom.c:12:
    ./ugfx/src/gfile/../../src/gos/gos_rules.h:31:5: warning: "GFX_EMULATE_MALLOC" is not defined [-Wundef]
    #if GFX_EMULATE_MALLOC
    ^
    In file included from ./ugfx/src/gfile/../../gfx.h:194:0,
    from ./ugfx/src/gfile/gfile_fs_ram.c:12:
    ./ugfx/src/gfile/../../src/gmisc/gmisc.h:229:5: warning: "GMISC_NEED_MATRIXFLOAT2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFLOAT2D || defined(__DOXYGEN__)
    ^
    ./ugfx/src/gfile/../../src/gmisc/gmisc.h:347:5: warning: "GMISC_NEED_MATRIXFIXED2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFIXED2D || defined(__DOXYGEN__)
    ^
    Compiling gfile_fs_fatfs.c
    Compiling gfile_fs_petitfs.c
    Compiling gfile_fs_mem.c
    In file included from ./ugfx/src/gfile/../../gfx.h:194:0,
    from ./ugfx/src/gfile/gfile_fs_rom.c:12:
    ./ugfx/src/gfile/../../src/gmisc/gmisc.h:229:5: warning: "GMISC_NEED_MATRIXFLOAT2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFLOAT2D || defined(__DOXYGEN__)
    ^
    ./ugfx/src/gfile/../../src/gmisc/gmisc.h:347:5: warning: "GMISC_NEED_MATRIXFIXED2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFIXED2D || defined(__DOXYGEN__)
    ^
    Compiling gfile_fs_chibios.c
    In file included from ./ugfx/src/gfile/../../gfx.h:186:0,
    from ./ugfx/src/gfile/gfile_fs_fatfs.c:12:
    ./ugfx/src/gfile/../../src/gos/gos_rules.h:31:5: warning: "GFX_EMULATE_MALLOC" is not defined [-Wundef]
    #if GFX_EMULATE_MALLOC
    ^
    Compiling gfile_fs_strings.c
    In file included from ./ugfx/src/gfile/../../gfx.h:186:0,
    from ./ugfx/src/gfile/gfile_fs_mem.c:12:
    ./ugfx/src/gfile/../../src/gos/gos_rules.h:31:5: warning: "GFX_EMULATE_MALLOC" is not defined [-Wundef]
    #if GFX_EMULATE_MALLOC
    ^
    In file included from ./ugfx/src/gfile/../../gfx.h:186:0,
    from ./ugfx/src/gfile/gfile_fs_petitfs.c:12:
    ./ugfx/src/gfile/../../src/gos/gos_rules.h:31:5: warning: "GFX_EMULATE_MALLOC" is not defined [-Wundef]
    #if GFX_EMULATE_MALLOC
    ^
    Compiling gfile_printg.c
    In file included from ./ugfx/src/gfile/../../gfx.h:186:0,
    from ./ugfx/src/gfile/gfile_fs_chibios.c:12:
    ./ugfx/src/gfile/../../src/gos/gos_rules.h:31:5: warning: "GFX_EMULATE_MALLOC" is not defined [-Wundef]
    #if GFX_EMULATE_MALLOC
    ^
    In file included from ./ugfx/src/gfile/../../gfx.h:194:0,
    from ./ugfx/src/gfile/gfile_fs_fatfs.c:12:
    ./ugfx/src/gfile/../../src/gmisc/gmisc.h:229:5: warning: "GMISC_NEED_MATRIXFLOAT2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFLOAT2D || defined(__DOXYGEN__)
    ^
    ./ugfx/src/gfile/../../src/gmisc/gmisc.h:347:5: warning: "GMISC_NEED_MATRIXFIXED2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFIXED2D || defined(__DOXYGEN__)
    ^
    In file included from ./ugfx/src/gfile/../../gfx.h:194:0,
    from ./ugfx/src/gfile/gfile_fs_petitfs.c:12:
    ./ugfx/src/gfile/../../src/gmisc/gmisc.h:229:5: warning: "GMISC_NEED_MATRIXFLOAT2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFLOAT2D || defined(__DOXYGEN__)
    ^
    ./ugfx/src/gfile/../../src/gmisc/gmisc.h:347:5: warning: "GMISC_NEED_MATRIXFIXED2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFIXED2D || defined(__DOXYGEN__)
    ^
    In file included from ./ugfx/src/gfile/../../gfx.h:194:0,
    from ./ugfx/src/gfile/gfile_fs_mem.c:12:
    ./ugfx/src/gfile/../../src/gmisc/gmisc.h:229:5: warning: "GMISC_NEED_MATRIXFLOAT2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFLOAT2D || defined(__DOXYGEN__)
    ^
    ./ugfx/src/gfile/../../src/gmisc/gmisc.h:347:5: warning: "GMISC_NEED_MATRIXFIXED2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFIXED2D || defined(__DOXYGEN__)
    ^
    In file included from ./ugfx/src/gfile/../../gfx.h:186:0,
    from ./ugfx/src/gfile/gfile_fs_strings.c:12:
    ./ugfx/src/gfile/../../src/gos/gos_rules.h:31:5: warning: "GFX_EMULATE_MALLOC" is not defined [-Wundef]
    #if GFX_EMULATE_MALLOC
    ^
    In file included from ./ugfx/src/gfile/../../gfx.h:194:0,
    from ./ugfx/src/gfile/gfile_fs_chibios.c:12:
    ./ugfx/src/gfile/../../src/gmisc/gmisc.h:229:5: warning: "GMISC_NEED_MATRIXFLOAT2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFLOAT2D || defined(__DOXYGEN__)
    ^
    ./ugfx/src/gfile/../../src/gmisc/gmisc.h:347:5: warning: "GMISC_NEED_MATRIXFIXED2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFIXED2D || defined(__DOXYGEN__)
    ^
    In file included from ./ugfx/src/gfile/../../gfx.h:186:0,
    from ./ugfx/src/gfile/gfile_printg.c:12:
    ./ugfx/src/gfile/../../src/gos/gos_rules.h:31:5: warning: "GFX_EMULATE_MALLOC" is not defined [-Wundef]
    #if GFX_EMULATE_MALLOC
    ^
    Compiling gfile_scang.c
    In file included from ./ugfx/src/gfile/../../gfx.h:194:0,
    from ./ugfx/src/gfile/gfile_fs_strings.c:12:
    ./ugfx/src/gfile/../../src/gmisc/gmisc.h:229:5: warning: "GMISC_NEED_MATRIXFLOAT2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFLOAT2D || defined(__DOXYGEN__)
    ^
    ./ugfx/src/gfile/../../src/gmisc/gmisc.h:347:5: warning: "GMISC_NEED_MATRIXFIXED2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFIXED2D || defined(__DOXYGEN__)
    ^
    Compiling gfile_stdio.c
    Compiling gfile_fatfs_wrapper.c
    In file included from ./ugfx/src/gfile/../../gfx.h:194:0,
    from ./ugfx/src/gfile/gfile_printg.c:12:
    ./ugfx/src/gfile/../../src/gmisc/gmisc.h:229:5: warning: "GMISC_NEED_MATRIXFLOAT2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFLOAT2D || defined(__DOXYGEN__)
    ^
    ./ugfx/src/gfile/../../src/gmisc/gmisc.h:347:5: warning: "GMISC_NEED_MATRIXFIXED2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFIXED2D || defined(__DOXYGEN__)
    ^
    Compiling gfile_fatfs_diskio_chibios.c
    In file included from ./ugfx/src/gfile/../../gfx.h:186:0,
    from ./ugfx/src/gfile/gfile_scang.c:12:
    ./ugfx/src/gfile/../../src/gos/gos_rules.h:31:5: warning: "GFX_EMULATE_MALLOC" is not defined [-Wundef]
    #if GFX_EMULATE_MALLOC
    ^
    In file included from ./ugfx/src/gfile/../../gfx.h:186:0,
    from ./ugfx/src/gfile/gfile_fatfs_wrapper.c:8:
    ./ugfx/src/gfile/../../src/gos/gos_rules.h:31:5: warning: "GFX_EMULATE_MALLOC" is not defined [-Wundef]
    #if GFX_EMULATE_MALLOC
    ^
    In file included from ./ugfx/src/gfile/../../gfx.h:186:0,
    from ./ugfx/src/gfile/gfile_stdio.c:12:
    ./ugfx/src/gfile/../../src/gos/gos_rules.h:31:5: warning: "GFX_EMULATE_MALLOC" is not defined [-Wundef]
    #if GFX_EMULATE_MALLOC
    ^
    Compiling gfile_petitfs_wrapper.c
    Compiling gfile_petitfs_diskio_chibios.c
    In file included from ./ugfx/src/gfile/../../gfx.h:194:0,
    from ./ugfx/src/gfile/gfile_scang.c:12:
    ./ugfx/src/gfile/../../src/gmisc/gmisc.h:229:5: warning: "GMISC_NEED_MATRIXFLOAT2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFLOAT2D || defined(__DOXYGEN__)
    ^
    ./ugfx/src/gfile/../../src/gmisc/gmisc.h:347:5: warning: "GMISC_NEED_MATRIXFIXED2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFIXED2D || defined(__DOXYGEN__)
    ^
    In file included from ./ugfx/src/gfile/../../gfx.h:194:0,
    from ./ugfx/src/gfile/gfile_fatfs_wrapper.c:8:
    ./ugfx/src/gfile/../../src/gmisc/gmisc.h:229:5: warning: "GMISC_NEED_MATRIXFLOAT2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFLOAT2D || defined(__DOXYGEN__)
    ^
    ./ugfx/src/gfile/../../src/gmisc/gmisc.h:347:5: warning: "GMISC_NEED_MATRIXFIXED2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFIXED2D || defined(__DOXYGEN__)
    ^
    In file included from ./ugfx/src/gfile/../../gfx.h:194:0,
    from ./ugfx/src/gfile/gfile_stdio.c:12:
    ./ugfx/src/gfile/../../src/gmisc/gmisc.h:229:5: warning: "GMISC_NEED_MATRIXFLOAT2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFLOAT2D || defined(__DOXYGEN__)
    ^
    ./ugfx/src/gfile/../../src/gmisc/gmisc.h:347:5: warning: "GMISC_NEED_MATRIXFIXED2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFIXED2D || defined(__DOXYGEN__)
    ^
    In file included from ./ugfx/src/gfile/../../gfx.h:186:0,
    from ./ugfx/src/gfile/gfile_fatfs_diskio_chibios.c:8:
    ./ugfx/src/gfile/../../src/gos/gos_rules.h:31:5: warning: "GFX_EMULATE_MALLOC" is not defined [-Wundef]
    #if GFX_EMULATE_MALLOC
    ^
    In file included from ./ugfx/src/gfile/../../gfx.h:186:0,
    from ./ugfx/src/gfile/gfile_petitfs_wrapper.c:8:
    ./ugfx/src/gfile/../../src/gos/gos_rules.h:31:5: warning: "GFX_EMULATE_MALLOC" is not defined [-Wundef]
    #if GFX_EMULATE_MALLOC
    ^
    In file included from ./ugfx/src/gfile/../../gfx.h:194:0,
    from ./ugfx/src/gfile/gfile_fatfs_diskio_chibios.c:8:
    ./ugfx/src/gfile/../../src/gmisc/gmisc.h:229:5: warning: "GMISC_NEED_MATRIXFLOAT2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFLOAT2D || defined(__DOXYGEN__)
    ^
    ./ugfx/src/gfile/../../src/gmisc/gmisc.h:347:5: warning: "GMISC_NEED_MATRIXFIXED2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFIXED2D || defined(__DOXYGEN__)
    ^
    In file included from ./ugfx/src/gfile/../../gfx.h:186:0,
    from ./ugfx/src/gfile/gfile_petitfs_diskio_chibios.c:8:
    ./ugfx/src/gfile/../../src/gos/gos_rules.h:31:5: warning: "GFX_EMULATE_MALLOC" is not defined [-Wundef]
    #if GFX_EMULATE_MALLOC
    ^
    Compiling main.c
    Compiling gdisp_lld_ILI9341.c
    In file included from ./ugfx/src/gfile/../../gfx.h:194:0,
    from ./ugfx/src/gfile/gfile_petitfs_wrapper.c:8:
    ./ugfx/src/gfile/../../src/gmisc/gmisc.h:229:5: warning: "GMISC_NEED_MATRIXFLOAT2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFLOAT2D || defined(__DOXYGEN__)
    ^
    ./ugfx/src/gfile/../../src/gmisc/gmisc.h:347:5: warning: "GMISC_NEED_MATRIXFIXED2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFIXED2D || defined(__DOXYGEN__)
    ^
    In file included from ./ugfx/src/gfile/../../gfx.h:194:0,
    from ./ugfx/src/gfile/gfile_petitfs_diskio_chibios.c:8:
    ./ugfx/src/gfile/../../src/gmisc/gmisc.h:229:5: warning: "GMISC_NEED_MATRIXFLOAT2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFLOAT2D || defined(__DOXYGEN__)
    ^
    ./ugfx/src/gfile/../../src/gmisc/gmisc.h:347:5: warning: "GMISC_NEED_MATRIXFIXED2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFIXED2D || defined(__DOXYGEN__)
    ^
    In file included from ./ugfx/gfx.h:186:0,
    from ./ugfx/drivers/gdisp/ILI9341/gdisp_lld_ILI9341.c:8:
    ./ugfx/src/gos/gos_rules.h:31:5: warning: "GFX_EMULATE_MALLOC" is not defined [-Wundef]
    #if GFX_EMULATE_MALLOC
    ^
    In file included from ./ugfx/gfx.h:186:0,
    from ./ugfx/demos/modules/gdisp/circles/main.c:30:
    ./ugfx/src/gos/gos_rules.h:31:5: warning: "GFX_EMULATE_MALLOC" is not defined [-Wundef]
    #if GFX_EMULATE_MALLOC
    ^
    In file included from ./ugfx/gfx.h:194:0,
    from ./ugfx/drivers/gdisp/ILI9341/gdisp_lld_ILI9341.c:8:
    ./ugfx/src/gmisc/gmisc.h:229:5: warning: "GMISC_NEED_MATRIXFLOAT2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFLOAT2D || defined(__DOXYGEN__)
    ^
    ./ugfx/src/gmisc/gmisc.h:347:5: warning: "GMISC_NEED_MATRIXFIXED2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFIXED2D || defined(__DOXYGEN__)
    ^
    In file included from ./ugfx/gfx.h:194:0,
    from ./ugfx/demos/modules/gdisp/circles/main.c:30:
    ./ugfx/src/gmisc/gmisc.h:229:5: warning: "GMISC_NEED_MATRIXFLOAT2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFLOAT2D || defined(__DOXYGEN__)
    ^
    ./ugfx/src/gmisc/gmisc.h:347:5: warning: "GMISC_NEED_MATRIXFIXED2D" is not defined [-Wundef]
    #if GMISC_NEED_MATRIXFIXED2D || defined(__DOXYGEN__)
    ^
    In file included from ./ugfx/drivers/gdisp/ILI9341/gdisp_lld_ILI9341.c:23:0:
    ./ugfx/drivers/gdisp/ILI9341/../../../src/gdisp/gdisp_driver.h:293:27: warning: "GDISP_PIXELFORMAT_CUSTOM" is not defined [-Wundef]
    && GDISP_PIXELFORMAT != GDISP_PIXELFORMAT_CUSTOM
    ^
    Linking build/ch.elf
    Creating build/ch.hex
    Creating build/ch.dmp
    Creating build/ch.bin
    Creating build/ch.list

    text data bss dec hex filename
    21154 352 20486 41992 a408 build/ch.elf

    Done

    16:08:17 Build Finished (took 17s.543ms)

    Thanks in advance :)

  12. Hey! How are you guys? Please, anyone can give me some directions?

    I'm a hobbist used to work with Atmel AVR family. I'm trying to learn something new here: I had an STM32F103 board laying around, so I made the decision to try it out. After some reading and experimentation I got it working as expected in eclipse. Really basic things, like the classic led blinking. The next step was to choose some nice RTOS and chibios was the winner! I managed to have chibios working on my board after I made my board configuration using another similar board as template.

    Actually, I'm trying to have my ILI9341 TFT display working using chibios and ugfx together. I don't know whats wrong, code is compiling fine but nothing is showed on display. I suspect it's something related to SPI setup. I made the test using stm32duino and the display is working.

    bEYJzXr.jpg

    The example I'm trying to run is the one named "circles".

    Warnings:


    Description Resource Path Location Type
    "GDISP_PIXELFORMAT_CUSTOM" is not defined [-Wundef] gdisp_driver.h /WDR-STM32F1xx-UART/ugfx/src/gdisp line 293 C/C++ Problem
    "GFX_EMULATE_MALLOC" is not defined [-Wundef] gos_rules.h /WDR-STM32F1xx-UART/ugfx/src/gos line 31 C/C++ Problem
    "GFX_EMULATE_MALLOC" is not defined [-Wundef] gos_x_heap.c /WDR-STM32F1xx-UART/ugfx/src/gos line 198 C/C++ Problem
    "GFX_USE_GAUDIN" is not defined [-Wundef] gfx.c /WDR-STM32F1xx-UART/ugfx/src line 138 C/C++ Problem
    "GMISC_NEED_MATRIXFIXED2D" is not defined [-Wundef] gmisc.h /WDR-STM32F1xx-UART/ugfx/src/gmisc line 347 C/C++ Problem
    "GMISC_NEED_MATRIXFIXED2D" is not defined [-Wundef] gmisc_matrix2d.c /WDR-STM32F1xx-UART/ugfx/src/gmisc line 106 C/C++ Problem
    "GMISC_NEED_MATRIXFLOAT2D" is not defined [-Wundef] gmisc.h /WDR-STM32F1xx-UART/ugfx/src/gmisc line 229 C/C++ Problem
    "GMISC_NEED_MATRIXFLOAT2D" is not defined [-Wundef] gmisc_matrix2d.c /WDR-STM32F1xx-UART/ugfx/src/gmisc line 12 C/C++ Problem
    "GOS_NEED_X_HEAP" is not defined [-Wundef] gos_x_heap.c /WDR-STM32F1xx-UART/ugfx/src/gos line 10 C/C++ Problem
    "GOS_NEED_X_THREADS" is not defined [-Wundef] gos_x_threads.c /WDR-STM32F1xx-UART/ugfx/src/gos line 10 C/C++ Problem

    chibios makefile:


    ##############################################################################
    # Build global options
    # NOTE: Can be overridden externally.
    #

    # Compiler options here.
    ifeq ($(USE_OPT),)
    USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16
    endif

    # C specific options here (added to USE_OPT).
    ifeq ($(USE_COPT),)
    USE_COPT =
    endif

    # C++ specific options here (added to USE_OPT).
    ifeq ($(USE_CPPOPT),)
    USE_CPPOPT = -fno-rtti
    endif

    # Enable this if you want the linker to remove unused code and data
    ifeq ($(USE_LINK_GC),)
    USE_LINK_GC = yes
    endif

    # Linker extra options here.
    ifeq ($(USE_LDOPT),)
    USE_LDOPT =
    endif

    # Enable this if you want link time optimizations (LTO)
    ifeq ($(USE_LTO),)
    USE_LTO = yes
    endif

    # If enabled, this option allows to compile the application in THUMB mode.
    ifeq ($(USE_THUMB),)
    USE_THUMB = yes
    endif

    # Enable this if you want to see the full log while compiling.
    ifeq ($(USE_VERBOSE_COMPILE),)
    USE_VERBOSE_COMPILE = no
    endif

    # If enabled, this option makes the build process faster by not compiling
    # modules not used in the current configuration.
    ifeq ($(USE_SMART_BUILD),)
    USE_SMART_BUILD = yes
    endif

    #
    # Build global options
    ##############################################################################

    ##############################################################################
    # Architecture or project specific options
    #

    # Stack size to be allocated to the Cortex-M process stack. This stack is
    # the stack used by the main() thread.
    ifeq ($(USE_PROCESS_STACKSIZE),)
    USE_PROCESS_STACKSIZE = 0x400
    endif

    # Stack size to the allocated to the Cortex-M main/exceptions stack. This
    # stack is used for processing interrupts and exceptions.
    ifeq ($(USE_EXCEPTIONS_STACKSIZE),)
    USE_EXCEPTIONS_STACKSIZE = 0x400
    endif

    # Enables the use of FPU on Cortex-M4 (no, softfp, hard).
    ifeq ($(USE_FPU),)
    USE_FPU = no
    endif

    #
    # Architecture or project specific options
    ##############################################################################

    ##############################################################################
    # Project, sources and paths
    #

    # Define project name here
    PROJECT = ch

    # Imported source files and paths
    CHIBIOS = ../../chibios161
    # Startup files.
    include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_stm32f1xx.mk
    # HAL-OSAL files (optional).
    include $(CHIBIOS)/os/hal/hal.mk
    include $(CHIBIOS)/os/hal/ports/STM32/STM32F1xx/platform.mk
    include $(CHIBIOS)/os/hal/boards/WDR_STM32F103C8/board.mk
    include $(CHIBIOS)/os/hal/osal/rt/osal.mk
    # RTOS files (optional).
    include $(CHIBIOS)/os/rt/rt.mk
    include $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk
    # Other files (optional).
    #include $(CHIBIOS)/test/rt/test.mk
    GFXDEMO = modules/gdisp/circles
    GFXLIB = ./ugfx
    include $(GFXLIB)/gfx.mk
    include $(GFXLIB)/boards/base/WDR_STM32F103C8/board.mk # board
    #include $(GFXLIB)/drivers/gaudio/vs1053/driver.mk # additional driver


    # Define linker script file here
    LDSCRIPT= $(STARTUPLD)/STM32F103xB.ld

    # C sources that can be compiled in ARM or THUMB mode depending on the global
    # setting.
    CSRC = $(STARTUPSRC) \
    $(KERNSRC) \
    $(PORTSRC) \
    $(OSALSRC) \
    $(HALSRC) \
    $(PLATFORMSRC) \
    $(BOARDSRC) \
    $(TESTSRC) \
    $(GFXSRC)
    #main.c

    # C++ sources that can be compiled in ARM or THUMB mode depending on the global
    # setting.
    CPPSRC =

    # C sources to be compiled in ARM mode regardless of the global setting.
    # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
    # option that results in lower performance and larger code size.
    ACSRC =

    # C++ sources to be compiled in ARM mode regardless of the global setting.
    # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
    # option that results in lower performance and larger code size.
    ACPPSRC =

    # C sources to be compiled in THUMB mode regardless of the global setting.
    # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
    # option that results in lower performance and larger code size.
    TCSRC =

    # C sources to be compiled in THUMB mode regardless of the global setting.
    # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
    # option that results in lower performance and larger code size.
    TCPPSRC =

    # List ASM source files here
    ASMSRC = $(STARTUPASM) $(PORTASM) $(OSALASM)

    INCDIR = $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \
    $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \
    $(GFXINC) \
    $(CHIBIOS)/os/various



    #
    # Project, sources and paths
    ##############################################################################

    ##############################################################################
    # Compiler settings
    #

    MCU = cortex-m3

    #TRGT = arm-elf-
    TRGT = arm-none-eabi-
    CC = $(TRGT)gcc
    CPPC = $(TRGT)g++
    # Enable loading with g++ only if you need C++ runtime support.
    # NOTE: You can use C++ even without C++ support if you are careful. C++
    # runtime support makes code size explode.
    LD = $(TRGT)gcc
    #LD = $(TRGT)g++
    CP = $(TRGT)objcopy
    AS = $(TRGT)gcc -x assembler-with-cpp
    AR = $(TRGT)ar
    OD = $(TRGT)objdump
    SZ = $(TRGT)size
    HEX = $(CP) -O ihex
    BIN = $(CP) -O binary

    # ARM-specific options here
    AOPT =

    # THUMB-specific options here
    TOPT = -mthumb -DTHUMB

    # Define C warning options here
    CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes

    # Define C++ warning options here
    CPPWARN = -Wall -Wextra -Wundef

    #
    # Compiler settings
    ##############################################################################

    ##############################################################################
    # Start of user section
    #

    # List all user C define here, like -D_DEBUG=1
    UDEFS =

    # Define ASM defines here
    UADEFS =

    # List all user directories here
    UINCDIR =

    # List the user directory to look for the libraries here
    ULIBDIR =

    # List all user libraries here
    ULIBS =

    #
    # End of user defines
    ##############################################################################

    RULESPATH = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC
    include $(RULESPATH)/rules.mk

    board_ILI9341_spi.h:


    /*
    * This file is subject to the terms of the GFX License. If a copy of
    * the license was not distributed with this file, you can obtain one at:
    *
    * http://ugfx.org/license.html
    */

    /**
    * @file boards/addons/gdisp/board_ILI9341_spi.h
    * @brief GDISP Graphic Driver subsystem board interface for the ILI9341 display.
    *
    * @note This file contains a mix of hardware specific and operating system specific
    * code. You will need to change it for your CPU and/or operating system.
    */

    #ifndef _GDISP_LLD_BOARD_H
    #define _GDISP_LLD_BOARD_H

    #define LCD_PORT GPIOA
    #define LCD_MOSI 7
    #define LCD_MISO 6
    #define LCD_SCK 5
    #define LCD_CS 4
    #define LCD_DC 2
    #define LCD_RES 3

    #define LCD_DC_CMD palClearPad(LCD_PORT, LCD_DC)
    #define LCD_DC_DATA palSetPad(LCD_PORT, LCD_DC)
    #define LCD_SCK_SET palSetPad(LCD_PORT, LCD_SCK)
    #define LCD_SCK_RES palClearPad(LCD_PORT, LCD_SCK)
    #define LCD_CS_RES palSetPad(LCD_PORT, LCD_CS)
    #define LCD_CS_SET palClearPad(LCD_PORT, LCD_CS)



    /**
    * SPI configuration structure.
    * Speed 12 MHz, CPHA=0, CPOL=0, 8bits frames, MSb transmitted first.
    * Soft slave select.
    */
    static const SPIConfig spi1cfg = {
    NULL,
    LCD_PORT,
    LCD_CS,
    //(SPI_CR1_MSTR | SPI_CR1_SPE | SPI_CR1_SSM | SPI_CR1_SSI)
    (SPI_CR1_MSTR | SPI_CR1_SPE | SPI_CR1_SSM | SPI_CR1_SSI | SPI_CR1_BR_2 | SPI_CR1_BR_1)
    };

    static void send_data(uint16_t data);

    /**
    * @brief Initialise the board for the display.
    *
    * @param[in] g The GDisplay structure
    *
    * @note Set the g->board member to whatever is appropriate. For multiple
    * displays this might be a pointer to the appropriate register set.
    *
    * @notapi
    */
    static GFXINLINE void init_board(GDisplay *g) {

    // As we are not using multiple displays we set g->board to NULL as we don't use it.
    g->board = 0;

    palSetPadMode(LCD_PORT, LCD_CS, PAL_MODE_OUTPUT_PUSHPULL);
    palSetPadMode(LCD_PORT, LCD_DC, PAL_MODE_OUTPUT_PUSHPULL);
    palSetPadMode(LCD_PORT, LCD_RES, PAL_MODE_OUTPUT_PUSHPULL);

    spiStart(&SPID1, &spi1cfg);
    spiSelectI(&SPID1);
    }

    /**
    * @brief After the initialisation.
    *
    * @param[in] g The GDisplay structure
    *
    * @notapi
    */
    static GFXINLINE void post_init_board(GDisplay *g) {
    (void) g;
    }

    /**
    * @brief Set or clear the lcd reset pin.
    *
    * @param[in] g The GDisplay structure
    * @param[in] state TRUE = lcd in reset, FALSE = normal operation
    *
    * @notapi
    */
    static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) {
    (void) g;

    if (state == TRUE) {
    palClearPad(LCD_PORT, LCD_RES);
    } else {
    palSetPad(LCD_PORT, LCD_RES);
    }
    }

    /**
    * @brief Set the lcd back-light level.
    *
    * @param[in] g The GDisplay structure
    * @param[in] percent 0 to 100%
    *
    * @notapi
    */
    static GFXINLINE void set_backlight(GDisplay *g, uint8_t percent) {
    (void) g;
    (void) percent;
    }

    /**
    * @brief Take exclusive control of the bus
    *
    * @param[in] g The GDisplay structure
    *
    * @notapi
    */
    static GFXINLINE void acquire_bus(GDisplay *g) {
    (void) g;
    }

    /**
    * @brief Release exclusive control of the bus
    *
    * @param[in] g The GDisplay structure
    *
    * @notapi
    */
    static GFXINLINE void release_bus(GDisplay *g) {
    (void) g;
    }

    /**
    * @brief Send data to the lcd.
    *
    * @param[in] data The data to send
    *
    * @notapi
    */
    static GFXINLINE void send_data(uint16_t data) {
    // http://forum.easyelectronics.ru/viewtopic.php?p=262122#p262122
    while (!(SPI1->SR & SPI_SR_TXE)); // ïðè âõîäå íà îòïðàâêó ïðîâåðÿåì - à ïóñòîé ëè SPI_DR
    SPI1->DR = data; // çàãðóçèëè â SPI_DR êîä êîìàíäû

    }

    /**
    * @brief Send data to the index register.
    *
    * @param[in] g The GDisplay structure
    * @param[in] index The index register to set
    *
    * @notapi
    */
    static GFXINLINE void write_index(GDisplay *g, uint16_t index) {
    (void) g;

    while (SPI1->SR & SPI_SR_BSY);
    LCD_CS_RES;
    LCD_DC_CMD; // ïåðåâîäèì äèñïëåé â ðåæèì êîìàíä
    LCD_CS_SET;
    send_data(index);
    while (SPI1->SR & SPI_SR_BSY); // ïîêà ôëàã óñòàíîâëåí (==1) -- ìîäóëü SPI çàíÿò
    /* ëèøíèé öèêë îæèäàíèÿ îêîí÷àíèÿ ïåðåäà÷è êîìàíäû ïîçâîëÿåò â äàëüíåéøåì ñëàòü
    * áàéòû äàííûõ áåç íåíóæíûõ îæèäàíèé è çàäåðæåê.
    */
    LCD_DC_DATA; // ïåðåâîäèì äèñïëåé â ðåæèì äàííûõ
    }

    /**
    * @brief Send data to the lcd with DC control.
    *
    * @param[in] g The GDisplay structure
    * @param[in] data The data to send
    *
    * @notapi
    */
    static GFXINLINE void write_data(GDisplay *g, uint16_t data) {
    (void) g;

    send_data(data);
    }

    /**
    * @brief Set the bus in read mode
    *
    * @param[in] g The GDisplay structure
    *
    * @notapi
    */
    static GFXINLINE void setreadmode(GDisplay *g) {
    (void) g;
    }

    /**
    * @brief Set the bus back into write mode
    *
    * @param[in] g The GDisplay structure
    *
    * @notapi
    */
    static GFXINLINE void setwritemode(GDisplay *g) {
    (void) g;
    }

    /**
    * @brief Read data from the lcd.
    * @return The data from the lcd
    *
    * @param[in] g The GDisplay structure
    *
    * @notapi
    */
    static GFXINLINE uint16_t read_data(GDisplay *g) {
    (void) g;
    return 0;
    }

    #endif /* _GDISP_LLD_BOARD_H */

    chibios_board/board.h


    /*
    ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
    */

    #ifndef _BOARD_H_
    #define _BOARD_H_

    /*
    * Setup for the Olimex STM32-P103 proto board.
    */

    /*
    * Board identifier.
    */
    #define BOARD_OLIMEX_STM32_P103
    #define BOARD_NAME "Olimex STM32-P103"

    /*
    * Board frequencies.
    */
    #define STM32_LSECLK 32768
    #define STM32_HSECLK 8000000

    /*
    * MCU type, supported types are defined in ./os/hal/platforms/hal_lld.h.
    */
    #define STM32F103xB

    /*
    * IO pins assignments.
    */
    #define GPIOA_SPI1_NSS 4 // pin 12
    #define GPIOA_SPI1_SCK 5 // pin 13
    #define GPIOA_SPI1_MISO 6 // pin 14
    #define GPIOA_SPI1_MOSI 7 // pin 15

    #define GPIOB_SPI2_NSS 12 // pin 1
    #define GPIOB_SPI2_SCK 13 // pin 2
    #define GPIOB_SPI2_MISO 14 // pin 3
    #define GPIOB_SPI2_MOSI 15 // pin 4



    /*
    * I/O ports initial setup, this configuration is established soon after reset
    * in the initialization code.
    *
    * The digits have the following meaning:
    * 0 - Analog input.
    * 1 - Push Pull output 10MHz.
    * 2 - Push Pull output 2MHz.
    * 3 - Push Pull output 50MHz.
    * 4 - Digital input.
    * 5 - Open Drain output 10MHz.
    * 6 - Open Drain output 2MHz.
    * 7 - Open Drain output 50MHz.
    * 8 - Digital input with PullUp or PullDown resistor depending on ODR.
    * 9 - Alternate Push Pull output 10MHz.
    * A - Alternate Push Pull output 2MHz.
    * B - Alternate Push Pull output 50MHz.
    * C - Reserved.
    * D - Alternate Open Drain output 10MHz.
    * E - Alternate Open Drain output 2MHz.
    * F - Alternate Open Drain output 50MHz.
    * Please refer to the STM32 Reference Manual for details.
    */

    /*
    * Port A setup.
    * Everything input with pull-up except:
    * PA0 - Normal input (BUTTON).
    * PA2 - Alternate output (USART2 TX).
    * PA3 - Normal input (USART2 RX).
    * PA11 - Normal input (USB DM).
    * PA12 - Normal input (USB DP).
    */

    /* #define VAL_GPIOACRL 0x88884B84 PA7...PA0 */
    /* #define VAL_GPIOACRH 0x88844888 PA15...PA8 */
    /* #define VAL_GPIOAODR 0xFFFFFFFF */

    #define VAL_GPIOACRL 0x88884B88 /* PA7...PA0 */
    #define VAL_GPIOACRH 0x888884B8 /* PA15...PA8 */
    #define VAL_GPIOAODR 0xFFFFFFFF

    /*
    * Port B setup.
    * Everything input with pull-up except:
    * PB13 - Alternate output (MMC SPI2 SCK).
    * PB14 - Normal input (MMC SPI2 MISO).
    * PB15 - Alternate output (MMC SPI2 MOSI).
    */
    #define VAL_GPIOBCRL 0x88888888 /* PB7...PB0 */
    #define VAL_GPIOBCRH 0xB4B88888 /* PB15...PB8 */
    #define VAL_GPIOBODR 0xFFFFFFFF

    /*
    * Port C setup.
    * Everything input with pull-up except:
    * PC4 - Normal input because there is an external resistor.
    * PC6 - Normal input because there is an external resistor.
    * PC7 - Normal input because there is an external resistor.
    * PC10 - Push Pull output (CAN CNTRL).
    * PC11 - Push Pull output (USB DISC).
    * PC12 - Push Pull output (LED).
    */
    #define VAL_GPIOCCRL 0x44848888 /* PC7...PC0 */
    #define VAL_GPIOCCRH 0x88833388 /* PC15...PC8 */
    #define VAL_GPIOCODR 0xFFFFFFFF

    /*
    * Port D setup.
    * Everything input with pull-up except:
    * PD0 - Normal input (XTAL).
    * PD1 - Normal input (XTAL).
    */
    #define VAL_GPIODCRL 0x88888844 /* PD7...PD0 */
    #define VAL_GPIODCRH 0x88888888 /* PD15...PD8 */
    #define VAL_GPIODODR 0xFFFFFFFF

    /*
    * Port E setup.
    * Everything input with pull-up except:
    */
    #define VAL_GPIOECRL 0x88888888 /* PE7...PE0 */
    #define VAL_GPIOECRH 0x88888888 /* PE15...PE8 */
    #define VAL_GPIOEODR 0xFFFFFFFF

    /*
    * USB bus activation macro, required by the USB driver.
    */
    #define usb_lld_connect_bus(usbp) palClearPad(GPIOC, GPIOC_USB_DISC)

    /*
    * USB bus de-activation macro, required by the USB driver.
    */
    #define usb_lld_disconnect_bus(usbp) palSetPad(GPIOC, GPIOC_USB_DISC)

    #if !defined(_FROM_ASM_)
    #ifdef __cplusplus
    extern "C" {
    #endif
    void boardInit(void);
    #ifdef __cplusplus
    }
    #endif
    #endif /* _FROM_ASM_ */

    #endif /* _BOARD_H_ */

    circles/gfxconf.h

    /*
    * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu
    * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket
    *
    * All rights reserved.
    *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions are met:
    * * Redistributions of source code must retain the above copyright
    * notice, this list of conditions and the following disclaimer.
    * * Redistributions in binary form must reproduce the above copyright
    * notice, this list of conditions and the following disclaimer in the
    * documentation and/or other materials provided with the distribution.
    * * Neither the name of the nor the
    * names of its contributors may be used to endorse or promote products
    * derived from this software without specific prior written permission.
    *
    * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
    * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
    * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
    * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
    * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
    * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    */

    #ifndef _GFXCONF_H
    #define _GFXCONF_H

    /* The operating system to use. One of these must be defined - preferably in your Makefile */
    #define GFX_USE_OS_CHIBIOS TRUE
    //#define GFX_USE_OS_WIN32 FALSE
    //#define GFX_USE_OS_LINUX FALSE
    //#define GFX_USE_OS_OSX FALSE

    /* GFX sub-systems to turn on */
    #define GFX_USE_GDISP TRUE
    #define GFX_USE_GMISC TRUE

    /* Features for the GDISP subsystem. */
    #define GDISP_NEED_VALIDATION TRUE
    #define GDISP_NEED_CLIP TRUE
    #define GDISP_NEED_CIRCLE TRUE
    #define GDISP_NEED_ELLIPSE TRUE
    #define GDISP_NEED_ARC TRUE

    /* Features for the GMISC subsystem */
    #define GMISC_NEED_FIXEDTRIG TRUE
    #define GMISC_NEED_FASTTRIG TRUE

    #endif /* _GFXCONF_H */

×
×
  • Create New...