Git Product home page Git Product logo

stm32f4xx-timers-pwm-pll-canbus-low-power-modes's Introduction

STM32F4xx-Timers-PWM-PLL-CANbus-Low-Power-Modes

This repository covers a famous online course on Udemy mentioned above. I learned different peripherals with code exercices related with PWM, CAN, and Low-power Mode MCUs.

Phase-locked loop

A phase-locked loop or phase lock loop (PLL) is a control system that generates an output signal whose phase is related to the phase of an input signal. There are several different types; the simplest is an electronic circuit consisting of a variable frequency oscillator and a phase detector in a feedback loop. The oscillator generates a periodic signal, and the phase detector compares the phase of that signal with the phase of the input periodic signal, adjusting the oscillator to keep the phases matched. (Source:Wikipedia)

Timers

The timer is an important application in Embedded systems, it maintains the timing of an operation in sync with a system clock or an external clock. The timer has so many applications such as measure time generating delays, they can also be used for generating baud rates.

Pulse-Width Modulation (PWM)

Pulse width modulation (PWM) is a powerful technique for controlling analog circuits with a microprocessor's digital outputs. PWM is employed in a wide variety of applications, ranging from measurement and communications to power control and conversion.

CANBus Guide Book

This website provides a well-structed documents for CAN Bus Protocol. Link: https://www.csselectronics.com/

I use CAN-SPI Transceiver module (MCP2515 Stand-Alone CAN Controller with SPI Interface)

Kvaser CANtegrity

Kvaser CANtegrity is signal integrity hardware that has been integrated in Kvaser’s CAN FD controller logic. The hardware adds high-speed sampling (640MHz) which provides more detailed data on each CAN frame.

This allows Kvaser CANtegrity to combine a) oscilloscope-level display of the bus signal, with b) exact interpretation of the CAN frame.

With this data it is possible to process the information and find deviations from the perfect CAN-frame, including phase shift of edges and unexpected edges.

CANtegrity hardware provides deep knowledge of the CAN-frames under analysis, and through that, a complete understanding of the CAN system can be achieved. An advantage over a traditional oscilloscope is being able to trigger on specific error frames or ACK bits, rather than just analog characteristics, such as level or pulse width.

stm32f4xx-timers-pwm-pll-canbus-low-power-modes's People

Contributors

mucahitdemir avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

bilalkutuk

stm32f4xx-timers-pwm-pll-canbus-low-power-modes's Issues

When and why would you use the keyword "static" in C programming?

In the C programming language, static is used with global variables and functions to set their scope to the containing file. In local variables, static is used to store the variable in the statically allocated memory instead of the automatically allocated memory.

Pointer arithmetic , incrementing a pointer

To understand pointer arithmetic, let us consider that ptr is an integer pointer which points to the address 1000. Assuming 32-bit integers, let us perform the following arithmetic operation on the pointer −

ptr++

After the above operation, the ptr will point to the location 1004 because each time ptr is incremented, it will point to the next integer location which is 4 bytes next to the current location.

Incrementing a Pointer

We prefer using a pointer in our program instead of an array because the variable pointer can be incremented, unlike the array name which cannot be incremented because it is a constant pointer. The following program increments the variable pointer to access each succeeding element of the array

#include <stdio.h>

const int MAX = 3;

int main () {

   int  var[] = {10, 100, 200};
   int  i, *ptr;

   /* let us have array address in pointer */
   ptr = var;
	
   for ( i = 0; i < MAX; i++) {

      printf("Address of var[%d] = %x\n", i, ptr );
      printf("Value of var[%d] = %d\n", i, *ptr );

      /* move to the next location */
      ptr++;
   }
	
   return 0;
}

When the above code is compiled and executed, it produces the following result −

Address of var[0] = bf882b30
Value of var[0] = 10
Address of var[1] = bf882b34
Value of var[1] = 100
Address of var[2] = bf882b38
Value of var[2] = 200

(Source: tutorialspoint)

Switch statement: must default be the last case?

The C99 standard is not explicit about this, but taking all facts together, it is perfectly valid.

A case and default label are equivalent to a goto label.

Any statement may be preceded by a prefix that declares an identifier as a label name. Labels in themselves do not alter the flow of control, which continues unimpeded across them. (Source: w3school)

What is Embedded C Programming? How is Embedded C different from C programming language?

Embedded C is a programming language that is an extension of C programming. It uses the same syntax as C and it is called “embedded” because it is used widely in embedded systems. Embedded C supports I/O hardware operations and addressing, fixed-point arithmetic operations, memory/address space access, and various other features that are required to develop fool-proof embedded systems. (Source: interviewbit)

image

Since 32-bit and 64-bit microcontrollers exist, why are 8-bit ones still in use?

The general reason is picking the right tool for the job. The three most common reasons are backward compatibility, price, and electrical power consumption. Backward compatibility is important when interfacing with existing infrastructure, especially in industrial environments, where in many cases, the electrical and operational constraints impact the choice of microcontrollers.

Generally, smaller microcontrollers (with narrower primary registers) are also cheaper. But they can contain a very large selection of peripherals and interfacing options, so they can be used in many situations that require advanced functionality but not high CPU speed.

Smaller microcontrollers also generally require less power to operate, which is especially important for IoT and battery-powered devices.
(Source: toptal)

Analog-to-Digital Conversion (ADC) Fundamentals

Microcontrollers are capable of detecting binary signals: is the button pressed or not? These are digital signals. When a microcontroller is powered from five volts, it understands zero volts (0V) as a binary 0 and a five volts (5V) as a binary 1.

The world however is not so simple and likes to use shades of gray. What if the signal is 2.72V? Is that a zero or a one?

What is the ADC?

An Analog-Digital Converter (ADC) is a very useful feature that converts an analog voltage on a pin to a digital number. By converting from the analog world to the digital world, we can begin to use electronics to interface with the analog world around us.

ADCs can vary greatly between microcontrollers. The ADC on the Arduino is a 10-bit ADC meaning it has the ability to detect 1,024 (2^10) discrete analog levels. Some microcontrollers (ST, TI, NXP, etc.) have 8-bit ADCs (2^8 = 256 discrete levels) and some have 16-bit ADCs (2^16 = 65,536 discrete levels).

image

Source: Sparkfun ADC fundamentals

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.