2018-10-12 07:41 AM
How do you use control the 7-segment display of the stm32l476-disco board using stm32CubeMX and Kiel? Could someone please help me get a 1 to show on it using this setup?
I am able to successfully control it using either GCC or Keil with the example I found online at http://web.eece.maine.edu/~zhu/book/lab/L4_Lab_02_LCD_C_Driver_Template.zip , but I want to use stm32CubeMX to manage other peripheral ports. Of course this tutorial doesn't use HAL, so it doesn't line up exactly the same.
I have been able to select all the LCD segments in cubemx and compile/upload with Keil5. LED toggles such as PE8 and PB2 work fine. I tried using HAL_GPIO_Toggle for GPIOD15 and Set, for example HAL_GPIO_WritePin(GPIOD, GPIO_BIT_15, GPIO_PIN_SET);
2018-10-12 02:53 PM
Hey I can help, but I dont have the time... to read..
all the leds are connected to the processor ?
which pins ?
all these pins need to be set to output..
what is 1 ? to show 1, SegB and SegC ?
you need a table, 0 offset gives you the segments you need to show 0.
0 is SegA,B,C,D,E,F = 0x3F
1 is SegB,C = 0x06
2 ...
2018-10-12 02:59 PM
dont forget the current limiting resistor... maximum allowed from the processor pin is about 20mA but totally not recommended. less than 1mA is good designing.
I use transistors BC817 and BC807 everywhere...
High currents from the processor pins ( >10mA ) will affect the A/D results,
best to avoid it by using transistor array if needed.
In your case I would use a transistor array. uln2003 was the old favorite
2018-10-13 08:23 AM
here is what I use: https://github.com/dannyf00/My-MCU-Libraries---2nd-try
the files are led4_pins.h/.c. they allow the ability to individually assign gpio pins to led pins. and support common cathode or common anode displays, from 1 to 8 digits.
you can easily remap the gpio functions to your favorite library and get it going in no time.
2018-10-13 10:36 AM
The L476 DISCO has a 6-position 14-segment LCD "glass", this is what the OP wants to drive using the on-chip "glass"-LCD controller.
Once the initialization is done, you don't manipulate the indivudual GPIOs, it's the task of the LCD controller. You write to respective positions of LCD_RAM, and then trigger the update by setting LCD_SR.UDR. Further updates are not allowed until the "update done" flag (LCD_SR.UDD) is set. The LCD chapter in RM is relatively clear in this procedure.
There will be probably functions in Cube/HAL for this, I don't Cube/CubeMX. You might want to have a look at the the Demonstration for the 'L476 Disco in Cube to learn how things are used from within Cube - it probably uses [STM32Cube_FW_L4_Vx.xx.x]\Drivers\BSP\STM32L476G-Discovery\stm32l476g_discovery_glass_lcd.c/.h which is where I'd look first.
JW