Jump to content

GunterO

Members
  • Posts

    32
  • Joined

  • Last visited

Everything posted by GunterO

  1. Hi Ivan47, There is an easy to use, Keil ready sample for the same setup you have online (http://jopl.dlnet.us/graphlcdarm.php) I made a quick connection with the LCD board I have (TFT_320QVT, same controller chips) and it works fine. I had to make some changes in the XPT2046/ADS7846 conversion routine, but that was quite easy. Made a video: https://drive.google.com/file/d/0B3B79f ... sp=sharing I hope it helps!
  2. Hi, I have some early experience with Keil µVision, ChibiOS/RT and µGFX. I've put a ready-to-compile sample online, with everything you need inside. It works fine on µVision v5.13 It's based on ChibiOS/RT 2.6.7 & a very recent copy of the Master branch of µGFX. Please share your mind-blowing stuff you make with it afterwards http://www.otte.be/stm32/20150320_STM3232F429I-DISCO_ChibiOS_uGFX_Sample.rar
  3. Ok, found all the info I need about the alternate GPIO functions in the data sheet of the STM32F405xx/STM32F407xx chip. Now it makes (more) sense to me :-)
  4. Hi, This is what I made of it. Feel free to optimize it :-) This file is working for all my situations. I have one question dough. For the Nucleo board (STM32L152RE), I can use a max clock speed of 8MHz (SPI_BaudRatePrescaler_4) for SPI2. For SPI1, 16MHz (SPI_BaudRatePrescaler_2) is working fine. Could be something wrong with the pin setup? I'm not 100% sure about the PAL_MODE_ALTERNATE(5) pin mode for the SPI pins. For instance, with the STM32F4-Discovery board, I need to use PAL_MODE_ALTERNATE(5) for SPI2 and PAL_MODE_ALTERNATE(6) for SPI3. Can you point me to a good document/tutorial where these pin modes are properly explained? Thanks! /* * 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 * * Altered, optimized an polished by Gunter Otté */ #ifndef _GDISP_LLD_BOARD_H #define _GDISP_LLD_BOARD_H #if defined(USE_STDPERIPH_DRIVER) // *** Use Tilen Majerle's libraries. This definition is usually specified by the compiler (well, for Keil it is :-)) #include "tm_stm32f4_ili9341.h" #else // *** Use ChibiOS/RT //**** ILI9341 on SPI. TESTED on STM32L1 AND STM32F4. // SPI communication method #define SPI_METHOD_IRQ 1 #define SPI_METHOD_POLLING 2 #define SPI_METHOD SPI_METHOD_POLLING // Target selection #define TARGET_SELECTION_NUCLEO_SPI1 1 #define TARGET_SELECTION_NUCLEO_SPI2 2 #define TARGET_SELECTION_DISCOVERY_SPI3 3 #define TARGET_SELECTION TARGET_SELECTION_NUCLEO_SPI1 #if TARGET_SELECTION == TARGET_SELECTION_NUCLEO_SPI1 // SPI_BaudRatePrescaler_2 tested OK #define SPI_DRIVER (&SPID1) #define SPI_PORT GPIOA #define SCK_PAD 5 //PA5 #define MISO_PAD 6 //PA6 #define MOSI_PAD 7 //PA7 #define CS_PORT GPIOA #define RESET_PORT GPIOA #define DNC_PORT GPIOA #define CS_PAD 4 // 0 = chip selected #define RESET_PAD 1 // 0 = reset #define DNC_PAD 0 // control=0, data=1 -- DNC or D/C #elif TARGET_SELECTION == TARGET_SELECTION_NUCLEO_SPI2 // For some reason, SPI_BaudRatePrescaler_4 is max for SPI2 #define SPI_DRIVER (&SPID2) #define SPI_PORT GPIOB #define SCK_PAD 13 //PB13 #define MISO_PAD 14 //PB14 #define MOSI_PAD 15 //PB15 #define CS_PORT GPIOA #define RESET_PORT GPIOA #define DNC_PORT GPIOA #define CS_PAD 4 // 0 = chip selected #define RESET_PAD 1 // 0 = reset #define DNC_PAD 0 // control=0, data=1 -- DNC or D/C #elif TARGET_SELECTION == TARGET_SELECTION_DISCOVERY_SPI3 // SPI_BaudRatePrescaler_2 tested OK // Pin & SPI setup #define SPI_DRIVER (&SPID3) #define SPI_PORT GPIOB #define SCK_PAD 3 //PB3 #define MISO_PAD 4 //PB4 #define MOSI_PAD 5 //PB5 #define CS_PORT GPIOC #define RESET_PORT GPIOD #define DNC_PORT GPIOD #define CS_PAD 2 // 0 = chip selected #define RESET_PAD 12 // 0 = reset #define DNC_PAD 13 // control=0, data=1 -- DNC or D/C #endif // SPI setup ajust " SPI_BaudRatePrescaler_X" to set SPI speed. // Peripherial Clock STM32F4-Discovery SPI1:84MHz, SPI2&SPI3:42MHz // Peripherial Clock STM32L152RE-Nucleo SPI1:32MHz // STM32F4-Discovery STM32L152RE-Nucleo // SPI1 SPI2/3 SPI1 #define SPI_BaudRatePrescaler_2 ((uint16_t)0x0000) // 42 MHz 21 MHZ 16 MHz #define SPI_BaudRatePrescaler_4 ((uint16_t)0x0008) // 21 MHz 10.5 MHz 8 MHz #define SPI_BaudRatePrescaler_8 ((uint16_t)0x0010) // 10.5 MHz 5.25 MHz 4 MHz #define SPI_BaudRatePrescaler_16 ((uint16_t)0x0018) // 5.25 MHz 2.626 MHz 2 MHz #define SPI_BaudRatePrescaler_32 ((uint16_t)0x0020) // 2.626 MHz 1.3125 MHz 1 MHz #define SPI_BaudRatePrescaler_64 ((uint16_t)0x0028) // 1.3125 MHz 656.25 KHz 500 KHz #define SPI_BaudRatePrescaler_128 ((uint16_t)0x0030) // 656.25 KHz 328.125 KHz 250 KHz #define SPI_BaudRatePrescaler_256 ((uint16_t)0x0038) // 328.125 KHz 164.06 KHz 125 KHz static SPIConfig spi_cfg = { NULL, CS_PORT, CS_PAD, SPI_BaudRatePrescaler_2 //Ajust speed here. It's quite unlikely that the ILI9341 can handle >21MHz clock ... }; #endif #include "gfx.h" static __inline void init_board(GDisplay *g) { (void) g; g->board = 0; #if defined(USE_STDPERIPH_DRIVER) TM_ILI9341_Init(); #else //Set up the pins.. palSetPadMode(CS_PORT, CS_PAD, PAL_MODE_OUTPUT_PUSHPULL | PAL_STM32_OSPEED_HIGHEST); #if (TARGET_SELECTION == TARGET_SELECTION_NUCLEO_SPI1) || (TARGET_SELECTION == TARGET_SELECTION_NUCLEO_SPI2) palSetPadMode(SPI_PORT, SCK_PAD, PAL_MODE_ALTERNATE(5) | PAL_STM32_OSPEED_HIGHEST); palSetPadMode(SPI_PORT, MISO_PAD, PAL_MODE_ALTERNATE(5)); palSetPadMode(SPI_PORT, MOSI_PAD, PAL_MODE_ALTERNATE(5) | PAL_STM32_OSPEED_HIGHEST); #elif TARGET_SELECTION == TARGET_SELECTION_DISCOVERY_SPI3 palSetPadMode(SPI_PORT, SCK_PAD, PAL_MODE_ALTERNATE(6) | PAL_STM32_OSPEED_HIGHEST); palSetPadMode(SPI_PORT, MISO_PAD, PAL_MODE_ALTERNATE(6)); palSetPadMode(SPI_PORT, MOSI_PAD, PAL_MODE_ALTERNATE(6) | PAL_STM32_OSPEED_HIGHEST); #endif palSetPadMode(DNC_PORT, DNC_PAD, PAL_MODE_OUTPUT_PUSHPULL | PAL_STM32_OSPEED_HIGHEST); palSetPadMode(RESET_PORT, RESET_PAD, PAL_MODE_OUTPUT_PUSHPULL | PAL_STM32_OSPEED_HIGHEST); //Set pins. palSetPad(CS_PORT, CS_PAD); palSetPad(RESET_PORT, RESET_PAD); palClearPad(DNC_PORT, DNC_PAD); //Start SPI with our config. spiStart(SPI_DRIVER, &spi_cfg); spiSelectI(SPI_DRIVER); /* Slave Select assertion. */ #endif } static __inline void post_init_board(GDisplay *g) { (void) g; } static __inline void setpin_reset(GDisplay *g, bool_t state) { (void) g; #if defined(USE_STDPERIPH_DRIVER) if(state == 1){ ILI9341_RST_RESET;} else { ILI9341_RST_SET; } #else palWritePad(RESET_PORT, RESET_PAD, !state); #endif } static __inline void set_backlight(GDisplay *g, uint8_t percent) { (void) g; (void) percent; } static __inline void acquire_bus(GDisplay *g) { (void) g; #if defined(USE_STDPERIPH_DRIVER) #else spiSelectI(SPI_DRIVER); #endif } static __inline void release_bus(GDisplay *g) { (void) g; #if defined(USE_STDPERIPH_DRIVER) #else spiUnselectI(SPI_DRIVER); #endif } static __inline void write_index(GDisplay *g, uint8_t index) { (void) g; #if defined(USE_STDPERIPH_DRIVER) TM_ILI9341_SendCommand(index); #else palClearPad(DNC_PORT, DNC_PAD); #if SPI_METHOD == SPI_METHOD_IRQ spiSend(SPI_DRIVER, 1, &index); #elif SPI_METHOD == SPI_METHOD_POLLING spiPolledExchange(SPI_DRIVER, index); #endif palSetPad(DNC_PORT, DNC_PAD); #endif } static __inline void write_data(GDisplay *g, uint8_t data) { (void) g; #if defined(USE_STDPERIPH_DRIVER) TM_ILI9341_SendData(data); #else #if SPI_METHOD == SPI_METHOD_IRQ spiSend(SPI_DRIVER, 1, &data); #elif SPI_METHOD == SPI_METHOD_POLLING spiPolledExchange(SPI_DRIVER, data); #endif #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 */
  5. Yeah, sure, would be great! I just want to polish the board file a little bit more so it is usable for multiple targets. Now I have a version for the Nucleo, and two for the STM32F4-Discovery (one based on ChibiOS and one on Tilen Majerle's libraries (bare metal, no RTOS)), and I want to merge them in a sort of easy to understand way for users who want to use it in different configurations.
  6. While porting this to the STM32F4-Discovery board, I found an error/typo in the board file. Took me a while to find it , so I want to save you the time in case you want to do the same or use a pin from another port ... //Set up the pins.. palSetPadMode(SPI_PORT, CS_PAD, PAL_MODE_OUTPUT_PUSHPULL | PAL_STM32_OSPEED_HIGHEST); needs to be of course: //Set up the pins.. palSetPadMode(CS_PORT, CS_PAD, PAL_MODE_OUTPUT_PUSHPULL | PAL_STM32_OSPEED_HIGHEST);
  7. Sure, you can find it here: http://www.otte.be/stm32/20150318_STM32F4-DISCO_uGFX.rar Didn't use something like WeTransfer so the download will be available for a longer time. All is include, to make sure it builds as it should be in Keil µVision (I used v5.13). I kept the naming scheme from Tilen Majerle (http://stm32f4-discovery.com/) and didn't move any of his or µGFX's library files around. The LCD is something like this: http://www.benl.ebay.be/itm/2-2-inch-2-2-SPI-TFT-LCD-Display-module-240x320-ILI9341-51-AVR-STM32-ARM-PIC-/200939222521?pt=LH_DefaultDomain_0&hash=item2ec8e935f9 Connected like this: LCD STM32F4-Discovery ---------------------------- SCK -> B3 MISO -> B4 (not used) MOSI -> B5 CS -> C2 RST -> D12 DC/RS -> D13 Added a video: https://drive.google.com/file/d/0B3B79fgnqTCaWXU4N3lSX1VKRHM/view?usp=sharing
  8. Well, the 21MHz is working with short dupont wires. I measured with a scope, and the SPI clock is indeed 21MHz, but the clock wave is looking like a sinus/triangle wave. I guess it is probably the maximum we can hope for
  9. Yep, there was the problem with the board file indeed. Those functions are expecting a byte, not a word. Anyway, now it is working perfect with µGFX. Another project working in my examples folder And I must say, even a lot faster then on the STM32L152RE-Nucleo board, but that was expected because of the high clock of the STM32F4-Discovery board. Maybe you can try to use SPI1, because it can run @ 42MHz (BaudRatePrescaler_4), while the max frequency for SPI2 & SPI3 is 21MHz (BaudRatePrescaler_8). I wonder how much this ILI9341 can take
  10. Hi Ivan, I've send you the project via WeTransfer (you should have received an e-mail about this). It compiles (no worries about the µGFX warnings, I have the same with my working projects). However, there is something wrong with your board_ILI9341.h file. I don't think you can just add the stuff from tm_stm32f4_ili9341.h and hope it works. Maybe you can look at my board file from here http://forum.ugfx.org/viewtopic.php?f=23&t=175&start=20#p1364 and see if it gets you any further. That board file is based on the ChibiOS/RT HAL, but maybe it can help you. I might look into this further when I have some spare time. Good luck!
  11. Well, no, sorry. I noticed it before in your comments, but the company is called Keil, not Kiel. So the definition needs to be "__KEIL__" and not "__KIEL__"
  12. I have your project compiling here, but I still need to test it with the board/LCD, will do this evening. If you want, I can send you the project, or you wait until I did some testing.
  13. Not really, because setjmp is defined by Keil (\ARM\ARMCC\include\setjmp.h), so it never reaches the #define _setjmp setjmp and gos_raw32.c needs _setjmp() #if !defined(__KEIL__) && !defined(__C51__) #ifndef setjmp #ifndef _setjmp #define _setjmp setjmp #endif #endif #ifndef longjmp #ifndef _longjmp #define _longjmp longjmp #endif #endif #endif Something like this would work better for me: #if !defined(__KEIL__) && !defined(__C51__) #if !defined(setjmp) && !defined(_setjmp) #define _setjmp setjmp #endif #if !defined(longjmp) && !defined(_longjmp) #define _longjmp longjmp #endif #else #if !defined(_setjmp) #define _setjmp setjmp #endif #if !defined(_longjmp) #define _longjmp longjmp #endif #endif Sorry, but one more issue/error I forgot about. Because of this error, I commented out this (src/gos/gos_raw32.h) : typedef char int8_t; #ifndef _STDINT_H // typedef char int8_t; typedef unsigned char uint8_t; typedef short int16_t; typedef unsigned short uint16_t; typedef int int32_t; typedef unsigned int uint32_t; #endif This would work: #ifndef _STDINT_H #if !defined(__KEIL__) && !defined(__C51__) typedef char int8_t; #endif typedef unsigned char uint8_t; typedef short int16_t; typedef unsigned short uint16_t; typedef int int32_t; typedef unsigned int uint32_t; #endif But maybe I'm missing something? Thanks!
  14. Hi, thanks for your reply. Yes, I found a possible issue with it. More details here: http://forum.ugfx.org/viewtopic.php?f=23&t=183 Maybe you can put a fix inside a #if defined(__KEIL__) ... #endif thing specific for µVision?
  15. Hello, I'm trying to get µGFX running on bare metal while using Keil µVision 5.13. I have almost everything compiling, except 1 problem with _setjmp(): in gos_raw32.c this is defined: #include /* jmp_buf, setjmp(), longjmp() */ #ifndef setjmp #ifndef _setjmp #define _setjmp setjmp #endif #endif setjmp.h is coming from \Keil_v5\ARM\ARMCC\include\setjmp.h Here is already setjmp defined: #define setjmp(jmp_buf) (__CLIBNS setjmp(jmp_buf)) What am I doing wrong? I have the option to comment out the #ifndef setjmp .. #endif from gos_raw32.c, then it compiles, but I don't want to mess in that code. Anybody an idea what I do best? Thanks!
  16. I have it compiling except 1 error: .\Targets\STM32F4_Discovery\project.axf: Error: L6218E: Undefined symbol _setjmp (referred from gos_raw32.o). I need to figure out why _setjmp() isn't found, but I'm close :-)
  17. I received your sourcecode. The CMSIS library you are using is quite old, you better download the most recent version (can be found on TM's website). Concerning µGFX library. You better keep this library it's default structure. Copying files into your own directory is in my opinion not a good idea. Just point µVision in the right direction is preferred. Makes it easier to maintain and upgrade the library later on. I keep all the libraries I use strictly separated. All I use in the projects folder are configuration files like defines.h, gfxconf.h, ... Anyway, as far I can see, you are not using any µGFX commands/code in your main.c. What exactly are you trying to do? Is current code working (without µGFX)? Because all this code is based on TM's libraries. Which SPI are you using on the F4 discovery? SPI3? Please tell me which pins you have connected to your LCD and how. All of them please.
  18. If you tell me how you connected the lcd to the discovery board (spi lines, cs, ...) I can have a look. I could find out from the source as well, but you better tell me to be sure and to verify I have here such a lcd and discovery board. Pm me for my e-mail so you can send the project.
  19. Which version of µGFX are you using? Does not look like the latest (Master) or even v2.2.
  20. Hi, I have some experience with Keil's µVision and µGFX, but I wonder why you don't want to use some RTOS as base? For example ChibiOS/RT has quite a good HAL worked out which you can use without the immediate need for multi threading knowledge or something like that. ChibiOS has a good support base/community and ChibiOS & µGFX are getting along very good :-) You are talking about STM32F4, do you mean the Discovery board? I guess you don't use the BaseBoard & LCD (SSD2119) because you mention ILI9341? Because I have some ready to use ChibiOS/µGFX/µVision samples for that combination. Concerning the ILI9341, how is this connected/configured? Via SPI or parallel? In case of SPI, I optimized the board file for this just recently :-)
  21. Yep, found a solution (with the help of Giovanni from ChibiOS) According to this, it is even faster then the mbed solution. Most likely because of the 16MHz <=> 12MHz SPI speed, and now the extra MHz are making a (visual) difference. But the best news is that ChibiOS is not causing any extra overload, and I want to stick with ChibiOS. What was the problem?: We were using the spiSend() method, but this is far from optimal when sending small packages (in our case, 1 pixel at the time). The DMA setup, and waiting for an interrupt was taking too long. This intended for transferring large amounts of data, not for 1 byte or something like that. For such situations, ChibiOS has the function spiPolledExchange(). This works without DMA and interrupts, but via polling. Less efficient for the system, but a lot faster for what we need. You can switch between the two methods via "SPI_METHOD" Here is the code: #ifndef _GDISP_LLD_BOARD_H #define _GDISP_LLD_BOARD_H //**** ILI9341 on SPI1. TESTED on STM32L1, STM32F1 AND STM32F4. // Pin & SPI setup #define SPI_METHOD_IRQ 1 #define SPI_METHOD_POLLING 2 #define SPI_METHOD SPI_METHOD_POLLING // SPI1 #define SPI_DRIVER (&SPID1) #define SPI_PORT GPIOA #define SCK_PAD 5 //PA5 #define MISO_PAD 6 //PA6 #define MOSI_PAD 7 //PA7 #define CS_PORT GPIOA #define RESET_PORT GPIOA #define DNC_PORT GPIOA #define CS_PAD 4 // PA4 -- 0 = chip selected #define RESET_PAD 1 // PA1 -- 0 = reset #define DNC_PAD 0 // PA0 -- control=0, data=1 -- DNC or D/C // SPI setup ajust " SPI_BaudRatePrescaler_X" to set SPI speed. // Peripherial Clock 42MHz SPI2 SPI3 // Peripherial Clock 84MHz SPI1 SPI1 SPI2/3 #define SPI_BaudRatePrescaler_2 ((uint16_t)0x0000) // 42 MHz 21 MHZ #define SPI_BaudRatePrescaler_4 ((uint16_t)0x0008) // 21 MHz 10.5 MHz #define SPI_BaudRatePrescaler_8 ((uint16_t)0x0010) // 10.5 MHz 5.25 MHz #define SPI_BaudRatePrescaler_16 ((uint16_t)0x0018) // 5.25 MHz 2.626 MHz #define SPI_BaudRatePrescaler_32 ((uint16_t)0x0020) // 2.626 MHz 1.3125 MHz #define SPI_BaudRatePrescaler_64 ((uint16_t)0x0028) // 1.3125 MHz 656.25 KHz #define SPI_BaudRatePrescaler_128 ((uint16_t)0x0030) // 656.25 KHz 328.125 KHz #define SPI_BaudRatePrescaler_256 ((uint16_t)0x0038) // 328.125 KHz 164.06 KHz static SPIConfig spi_cfg = { NULL, CS_PORT, CS_PAD, SPI_BaudRatePrescaler_2 //AJUST SPEED HERE.. }; static inline void init_board(GDisplay *g) { (void) g; g->board = 0; //Set up the pins.. palSetPadMode(SPI_PORT, CS_PAD, PAL_MODE_OUTPUT_PUSHPULL | PAL_STM32_OSPEED_HIGHEST); palSetPadMode(SPI_PORT, SCK_PAD, PAL_MODE_ALTERNATE(5) | PAL_STM32_OSPEED_HIGHEST); palSetPadMode(SPI_PORT, MISO_PAD, PAL_MODE_ALTERNATE(5)); palSetPadMode(SPI_PORT, MOSI_PAD, PAL_MODE_ALTERNATE(5) | PAL_STM32_OSPEED_HIGHEST); palSetPadMode(RESET_PORT, RESET_PAD, PAL_MODE_OUTPUT_PUSHPULL | PAL_STM32_OSPEED_HIGHEST); palSetPadMode(DNC_PORT, DNC_PAD, PAL_MODE_OUTPUT_PUSHPULL | PAL_STM32_OSPEED_HIGHEST); //Set pins. palSetPad(CS_PORT, CS_PAD); palSetPad(RESET_PORT, RESET_PAD); palClearPad(DNC_PORT, DNC_PAD); //Start SPI1 with our config. spiStart(SPI_DRIVER, &spi_cfg); spiSelectI(SPI_DRIVER); /* Slave Select assertion. */ } static inline void post_init_board(GDisplay *g) { (void) g; } static inline void setpin_reset(GDisplay *g, bool_t state) { (void) g; palWritePad(RESET_PORT, RESET_PAD, !state); } static inline void set_backlight(GDisplay *g, uint8_t percent) { (void) g; (void) percent; } static inline void acquire_bus(GDisplay *g) { (void) g; spiSelectI(SPI_DRIVER); } static inline void release_bus(GDisplay *g) { (void) g; spiUnselectI(SPI_DRIVER); } static inline void write_index(GDisplay *g, uint8_t index) { (void) g; palClearPad(DNC_PORT, DNC_PAD); #if SPI_METHOD == SPI_METHOD_IRQ spiSend(SPI_DRIVER, 1, &index); #elif SPI_METHOD == SPI_METHOD_POLLING spiPolledExchange(SPI_DRIVER, index); #endif palSetPad(DNC_PORT, DNC_PAD); } static inline void write_data(GDisplay *g, uint8_t data) { (void) g; #if SPI_METHOD == SPI_METHOD_IRQ spiSend(SPI_DRIVER, 1, &data); #elif SPI_METHOD == SPI_METHOD_POLLING spiPolledExchange(SPI_DRIVER, 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 */
  22. Thanks for your reply. I was suspecting the same. Maybe I should make a post about this on the ChibiOS forum. I will look into the SAM7EX256 code you suggested, and hopefully I can port it to something I can use.
  23. This is the CLK of the mbed sample. Frequency looks like +/- 12MHz. This is the CLK of the ChibiOS/µGFX sample. Frequency looks like +/- 16MHz. Higher! However, the mbed sample has more of those "bursts" in a same period of time: ChibiOS/µGFX : Anybody any idea why via mbed, there is more data transmitted in the same period of time, even when the CLK is lower? Could this be because of the bit banging method which mbed may be using?
  24. Thanks for the tips. - All board routines are marked "static inline" - I changed the DNC setters as you suggested. It made a small difference, but not the one I hoped for. Concerning "bit banging". I'm afraid I'm not advanced enough to make that change myself, but any help welcome! Next I gonna measure the SPI lines in the two situations with a scope, and verify if the SPI baudrate is actually the speed as set in the code. With the mbed example, I need to lower the SPI baudrate to <1MHz to have the same visual speed as with the µGFX example where SPI is (supposed to be) 16Mhz (SPI_BaudRatePrescaler_2, MCU clock = 32MHz (STM32L152RET6)).
  25. The mbed routines are using simple filling as well: //////////////////////////////////////////////////////////////////////////////////////////////// // Draws a filled rectangle //////////////////////////////////////////////////////////////////////////////////////////////// void ILI9340_Display::FillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t colour) { // rudimentary clipping (drawChar w/big text requires this) if((x >= _width) || (y >= _height)) return; if((x + w - 1) >= _width) w = _width - x; if((y + h - 1) >= _height) h = _height - y; SetAddrWindow(x, y, x+w-1, y+h-1); uint8_t hi = colour >> 8, lo = colour; dc = 1; cs = 0; for(y=h; y>0; y--) { for(x=w; x>0; x--) { spi.write(hi); spi.write(lo); } } cs = 1; }
×
×
  • Create New...