Jump to content

david1982

Members
  • Posts

    29
  • Joined

  • Last visited

Posts posted by david1982

  1. The connection diagram is in the zip attachment. The LCD connector is in the bottom left.

    And the board_ILI9325.h file that I am using is the second pice of code in my first post (the one I miss labeled).

    I did not think SPI required so many data pins?.

    Thank you for your help.

  2. Sorry my mistake I am using board_ILI9325 I just mislabeled it in the post.

    The above board.h file is one I have modified to suit my board I just used the "Olimex STM32-LCD" board file as a base as it compiled/worked with the blinking led example.

    Also rccEnableAHB(RCC_AHBENR_FSMCEN, 0); in the driver file causes a error..

    'RCC_AHBENR_FSMCEN' undeclared (first use in this function)

    Below are some pics and the board schematic.

    Images..

    https://drive.google.com/file/d/0B_B2fQCYwJRiRkJFdGNLUHcySWs/view?usp=sharing

    https://drive.google.com/file/d/0B_B2fQCYwJRibWhkWVRZTEk4eGM/view?usp=sharing

    MINI_STM32-V3.0_SCH.pdf.zip

  3. Hello All,

    I am trying to get my LCD to work but my data is sent via GPIOC 0...7 and GPIOB 8...15 and for the life of me I cannot get it to work.

    All I am trying to do is get the gdisp circle demo going..

    Below are my board file and driver file..

    Please just a kick in the right direction would be appreciated.

    board.h

    #ifndef _BOARD_H_
    #define _BOARD_H_

    /*
    * Setup for the ST INEMO-M1 Discovery board.
    */

    /*
    * Board identifier.
    */
    #define BOARD_OLIMEX_STM32_LCD
    #define BOARD_NAME "Olimex STM32-LCD"

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


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

    /*
    * IO pins assignments.
    */
    #define GPIOA_KEY1 0
    #define GPIOA_KEY2 1
    #define GPIOA_LED1 2
    #define GPIOA_LED2 3
    #define GPIOA_SPI1_NSS 4
    #define GPIOA_SPI1_SCK 5
    #define GPIOA_SPI1_MISO 6
    #define GPIOA_SPI1_MOSI 7
    #define GPIOA_PA8 8 /* FREE PA8/USART1_CK/TIM1_CH1/MCO */
    #define GPIOA_USART1_TX 9
    #define GPIOA_USART1_RX 10
    #define GPIOA_PA11 11
    #define GPIOA_PA12 12
    #define GPIOA_SWDIO 13
    #define GPIOA_SWCLK 14
    #define GPIOA_PA15 15

    #define GPIOB_PB0 0 /* VR */
    #define GPIOB_PB1 1 /* FREE PB1/ADC12_IN9/TIM2_CH4/TIM1_CH3N */
    #define GPIOB_PB2 2 /* BOOT */
    #define GPIOB_PB3 3 /* JTAG JTDO */
    #define GPIOB_PB4 4 /* JTAG JNTRST */
    #define GPIOB_LE 5
    #define GPIOB_F_CS 6
    #define GPIOB_SD_CS 7
    #define GPIOB_DB08 8
    #define GPIOB_DB09 9
    #define GPIOB_DB10 10
    #define GPIOB_DB11 11
    #define GPIOB_DB12 12
    #define GPIOB_DB13 13
    #define GPIOB_DB14 14
    #define GPIOB_DB15 15

    #define GPIOC_DB00 0
    #define GPIOC_DB01 1
    #define GPIOC_DB02 2
    #define GPIOC_DB03 3
    #define GPIOC_DB04 4
    #define GPIOC_DB05 5
    #define GPIOC_DB06 6
    #define GPIOC_DB07 7
    #define GPIOC_CS 8
    #define GPIOC_RS 9
    #define GPIOC_WR 10
    #define GPIOC_RD 11
    #define GPIOC_BL_EN 12
    #define GPIOC_TP_INT 13
    #define GPIOC_PC14 14
    #define GPIOC_PC15 15

    #define GPIOD_OSC_IN 0
    #define GPIOD_OSC_OUT 1
    #define GPIOD_PD2 2

    /*
    * 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.
    */

    #define VAL_GPIOACRL 0x88384B88 /* PA7...PA0 */
    #define VAL_GPIOACRH 0x88888883 /* PA15...PA8 */
    #define VAL_GPIOAODR 0xFFFFBFDF

    /*
    * Port B setup.
    * Everything input with pull-up except:
    * PB3 - Pull-up input (GPIOA_SWO).
    */
    #define VAL_GPIOBCRL 0x88388888 /* PB7...PB0 */
    #define VAL_GPIOBCRH 0xBBBBBBBB /* PB15...PB8 */
    #define VAL_GPIOBODR 0xFFFFFFFF

    /*
    * Port C setup.
    * Everything input with pull-up except:
    * PC13 - Normal input (GPIOC_BUTTON).
    */
    #define VAL_GPIOCCRL 0xBBBBBBBB /* PC7...PC0 */
    #define VAL_GPIOCCRH 0x8847BBBB /* PC15...PC8 */
    #define VAL_GPIOCODR 0xFFFFFFFF

    /*
    * Port D setup.
    * Everything input with pull-up except:
    * PD0 - Normal input (GPIOD_OSC_IN).
    * PD1 - Normal input (GPIOD_OSC_OUT).
    */
    #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)

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

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

    #endif /* _BOARD_H_ */

    board_ILI9325.h

    #ifndef GDISP_LLD_BOARD_H
    #define GDISP_LLD_BOARD_H

    // For a multiple display configuration we would put all this in a structure and then
    // set g->board to that structure.
    #define GDISP_REG (*((volatile uint16_t *) 0x60000000)) /* RS = 0 */
    #define GDISP_RAM (*((volatile uint16_t *) 0x60020000)) /* RS = 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;

    // switch(g->controllerdisplay) {
    // case 0: // Set up for Display 0
    /* FSMC setup for F1 */
    //rccEnableAHB(RCC_AHBENR_FSMCEN, 0);

    /* set pin modes */
    IOBus busC = {GPIOC, (1 << 0) | (1 << 1) | (1 << 4) | (1 << 5) | (1 << 7), 0};
    IOBus busB = {GPIOB, (1 << 8) | (1 << 9) | (1 << 10) | (1 << 11) | (1 << 12) | (1 << 13) | (1 << 14) | (1 << 15), 0};
    palSetBusMode(&busC, PAL_MODE_STM32_ALTERNATE_PUSHPULL);
    palSetBusMode(&busB, PAL_MODE_STM32_ALTERNATE_PUSHPULL);
    //palSetPadMode(GPIOC, GPIOC_TFT_RST, PAL_MODE_OUTPUT_PUSHPULL);
    palSetPadMode(GPIOC, GPIOC_BL_EN, PAL_MODE_OUTPUT_PUSHPULL);

    const unsigned char FSMC_Bank = 0;

    /* FSMC timing */
    FSMC_Bank1->BTCR[FSMC_Bank+1] = (9) | (10 << 7) | (10 << 15);

    /* Bank1 NOR/SRAM control register configuration
    * This is actually not needed as already set by default after reset */
    FSMC_Bank1->BTCR[FSMC_Bank] = FSMC_BCR1_MWID_0 | FSMC_BCR1_WREN | FSMC_BCR1_MBKEN;
    // break;
    // }
    }

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

    static inline void setpin_reset(GDisplay *g, bool_t state) {
    (void) g;

    }

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

    static inline void acquire_bus(GDisplay *g) {
    (void) g;
    }

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

    static inline void write_index(GDisplay *g, uint16_t index) {
    (void) g;
    GDISP_REG = index;
    }

    static inline void write_data(GDisplay *g, uint16_t data) {
    (void) g;
    GDISP_RAM = data;
    }

    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 GDISP_RAM;
    }

    #endif /* GDISP_LLD_BOARD_H */

×
×
  • Create New...