Control WVGA display with stm32f429-discovery LTDC - c

I am trying to output some data on the 7 inch TFT-LCD display (MCT070PC12W800480LML) using LCD-TFT display controller (LTDC 18 bits) on STM32F4.
LTDC interface setting are configured in CubeMx. In the program lcd data buffer is created with some values and it's starting address is mapped to the LTDC frame buffer start address.
At this moment display doesn't react to data sent by the LTDC. It only shows white and black strips, after i connect ground and power for digital circuit to the 3 volts source. VLED+ is connected to the 9 volts source. The VSYNC, HSYNC and CLOCK signals are generated by the LTDC and they match with specified values. I measured them on LCD strip, so the connection should be right. I also tried putting pulse on the LCD reset pin, but that doesn't make any sense.
The timing setting might be wrong.
LTDC clock is 33 MHz.
Here is the link to the diplay datasheet http://www.farnell.com/datasheets/2151568.pdf?_ga=2.128714188.1569403307.1506674811-10787525.1500902348 I saw some other WVGA displays using the same timing for synchronization signals, so i assume that timings are standard for that kind of displays.
Maybe signal polarity is wrong or i am missing something else. The program i am using now, worked on stm32f429-discovery build in LCD i just changed the timings. Any suggestions?
Thank you.

It could be something else, but I can see a problem with your timing values.
The back porch for both horizontal and vertical includes the sync pulses, but there must be a sync pulse width. My observation is that you have tried to get the total clocks for h = 1056 and v = 525 as per the data sheet by setting the sync pulses to 0. That won't work.
I would make the hsync pulse 20 and vysnc 10. The total clocks will be the same, but it is not critical that they match the spec sheet.

Related

stm32: PWM generator with 1/20 pulses

I'm struggeling on setting up a STM32-F429ZI MCU (Nucleo 144 board) to generate following PWM pattern:
First channel with a variable frequency and 50% duty cycle - at least I've got this working -
Second channel giving a pulse with each 20th pulse of channel 1.
This is not primary a coding problem but a understanding problem of timer settings i guess (working with STM32CubeIDE). I would bet there is real simple solution...
I Think there is no way to do this with only 1 timer?
I'm pleased for any suggestion...
I already tried with TIM2 as clock source for TIM3 and 4 but couldn't manage to make them synchonize.
For better illustration of what I want to do:
I't not sure, if it could be done with two timer synchronization (the pitfall is variable frequency of the first timer). But you can use single timer+DMA to rewrite configuration of the second channel:
Create in-memory array of 20 values, where one value enables the second channel and other 19 disables it
Setup DMA to trigger on the timer update and to move data from the array to CCMRx (or CCRx) register. Of cource, DMA should be in circular mode

DC Motor speed and direction with PWM PSoC

I need to be able to change the direction and speed of a small dc motor using an PSoC LP5 and a L293D. The motor that was used is one of these: https://www.elecrow.com/dc-toy-hobby-motor-130-size-p-265.html. I was able to change the direction without PWM by changing the inputs, this gave me the following table.
But then I also had to change the speed. The schematics for this project can be found below. The PWM period has been set to 1000.
My code looks like this:
int main(void)
{
PWM_1_Start();
for(;;)
{
DIRECTION_Write(0);
PWM_1_WriteCompare(400);
CyDelay(2000);
// 2 seconds clockwise low speed
PWM_1_WriteCompare(0);
CyDelay(2000);
// 1 second nothing
DIRECTION_Write(1);
PWM_1_WriteCompare(400);
CyDelay(2000);
// 2 seconds counter-clockwise low speed
PWM_1_WriteCompare(0);
CyDelay(2000);
// 1 second nothing
}
}
The motor now only turns counter-clockwise, then stops for 5ish seconds en does the same again. I've tried other combinations such as also using SPEED_Write, but didn't get the result I wanted.
Any help is appreciated, thanks in advance :)
I've done exact thing with an L298, which I think is esentially the same as an L293. It's easiest to switch the EN pin and not the IN# pins. Move your PWM to EN1, and then control the direction with IN1 and IN2. When IN1 is 0 and IN2 is 1, the motor moves CCW. When the pins are reversed, it moves in the other direction.
With a PSoC5 you can control both IN# pins with 1 signal. Add a 1-bit Control Register to your schematic and connect it to 2 pin components Then put a NOT gate between the second Gpio and the control register. Then you can write to the Control Register, and both Gpios will be toggled at the same time, but will always be the opposite of each other.

Stm32 PWM sampling

I have a timer set up in the cube to make a PWM... Just setting ARR and CCR to different values.
I'm using the callback functions for both events that HAL set up for me, I think one is for the CCR compare event and the other is for the ARR compare event.
Anyway, in both of those I'm toggling a GPIO port like this:
GPIOC->ODR = foo;
Anyway, I want to sample the values of 3 ADC1 channels during the high pulse, but I'm not sure how to do that accurately. I'm using DMA in circular mode with the ADC1 right now.
I don't want to sample immediately after setting the pins, because there's propagation delay, noise, etc.
So, I want to:
Set the pins, wait a very short and constant amount of time, sample all the channels and then do some math on the results.
This is for a Bldc motor controller, by the way... Im trying to sample the BEMF on the positive side of the PWM drive signal, and I'm driving it at 18khz, 5% duty cycle, so my pulse lasts for 2.7us.
I'm not sure how to handle or debug this because it's so timing related and I need the motor to deliver the signal that I'm using... If the motor isn't spinning, then there's no feedback signal to work on. It sure seems like I'm trying to do too much in the timer ISRs, though.
Sorry I can't post any code right now... Im at the grocery store, but I'll put some up when I get back.

STM32 - TIM2_ETR pin, connected to pin PA0 (button), incrementing the timer in strange way

I am trying to implement PWM LED dimming in 6 stages, where each stage in more bright, based on clicking button, which increments external pin, which serves the value to timer.
I am facing a problem, that sometimes, value variable is too large than it should be and skips some levels of brightness. For example, value increments: 1,2,3, then jumps to 6,7, etc.
Can anybody pinpoint where is the mistake I am making.
Here is the code:
//EDIT: code removed, because it is a school assignment
This looks like contact bouncing. When input is processed by the CPU, a simple way to solve it is to disable input for a certain duration after an event is detected. Since you directly control timer input from a button, you may not have much control. However, I would experiment with the ETF field of the SMCR register (which in your case is likely set by the sClockSourceConfig.ClockFilter field) and the clock divisor CKD of the CR1 register (which seems like htim2.Init.ClockDivision in your code) (sorry, I am not familiar with STM libraries).

Configuration of ADC Renesas RX62N

I am using a Renesas RX62N; my screen uses ADC unit 1 and my code uses Unit 0.
Is it so that the two ADC units cannot work together? When I run the "ADC" and the "Display code" separately it works fine but as soon as I try to integrate them and get the ADC values on screen the variable stops to read!. Any solutions?
A quick look at the user manual indicates that you can use either the one 12 bit ADC or two 10 bit ADCs, but you cannot select the 10 and 12 bit ADCs simultaneously.
Thankyou all for your suggestions and time.
I was able to solve the issue. The problem as you pointed was that the 12 and the 10 bit adcs cannot work together and moreover all the channels in the 12bit are used up by my touchscreen. So by adding timers,delays and using DMAC I was able to finally get my ADC data to the display screen.
Regards
Ashish

Resources