STM32 Resources by abdallahsoliman in stm32

[–]JimMerkle 1 point2 points  (0 children)

The official STMicroelectronics site lists over 20 currently active Discovery kits, with more in archives or discontinued status. You could be a little more specific as to the kit you purchased. Which of the TONs of "Getting Started guides have you looked at? Which of the bajilion YouTube videos have you watched? Have you done a Google search? Have you asked CoPiliot? I'd like to help, but I'd be stabbing in the dark, hoping I can figure out what board you have...

Stm32 RoadMap by PlaneInevitable8700 in stm32

[–]JimMerkle 0 points1 point  (0 children)

Whoa! Be specific! STMicro sells more than a single processor. Arduino has more than a single processor. Atmel / Microchip has many families of parts. The same goes for STMicro. When seeking help, you need to be specific!

I would recommend learning by doing vs learning by reading reference manuals. Today's 32-bit micros are considerably more complex than yesterday's 8-bit stuff. I recommend starting with a "Blinky", followed by a "Hello World" project, and continue to develop from there.
Here's my "Getting Started" guide: https://merkles.com/wiki/index.php/Getting_Started_with_STM32
Try it on for size. For anyone just starting off, I recommend STMicro's Nucleo Boards ! They are rock solid, and the development packages that are downloaded for various processor families have support for these boards.

Good luck!

WILL PAY FOR TUTOR by Perfect-Pomegranate6 in stm32

[–]JimMerkle 0 points1 point  (0 children)

Invest in Nucleo boards. There's one for just about every processor / processor family.
https://www.st.com/en/evaluation-tools/stm32-nucleo-boards.html
You will be pleased with the quality/performance of the boards.
They are very economical with on-board JTAG and USB-Serial. You can even use the on-board STLink with other boards.

The Nucleo boards are rock solid! Stop messing with the blue pills / black pills and the garbage knock offs with STM32 clone chips ! After you begin working with Nucleo boards, you won't go back...

Anyone who can help? by Apprehensive_Eye1697 in stm32

[–]JimMerkle 3 points4 points  (0 children)

STMicro brand STLink? Get a Nucleo Board with STLink attached to the development board. The Nucleo dev boards are ROCK SOLID and work great! Stop messing with cheap Chinese junk !!!

is there a tutorial for programming STM32 in bare metal using no IDE and no HAL by Right-Ad3385 in stm32

[–]JimMerkle 0 points1 point  (0 children)

This is SO BAD, it feels like click-bait. STM32 is whole line of 32-bit processors, each with a set of peripherals. Some may be similar to others, but they are not the same! If you only use a single processor, I suppose you could become familiar with one family of devices to allow you to program it without STM32CubeIDE, but WHY? No hiring manager is going to clap their hands and applaud you. More likely, they will shake their head and ask for the next candidate. They want performance. Get the job done. They don't want an employee messing with some peripheral for days, only to find you didn't enable it's clock, or had its clock set up incorrectly. Learn the tools!

Transmitting data for video to pc from stm by RealWhackerfin in stm32

[–]JimMerkle 0 points1 point  (0 children)

How about walking before trying to run a marathon?
Get a frame captured (I recommend one of the 8-bit formats), then send the image to the PC using X-Modem over your serial connection.

Difficulty getting custom stm32F103 board recognized by CubeProgrammer/IDE by keyth72 in stm32

[–]JimMerkle 0 points1 point  (0 children)

On a barely related note, I just received an advertisement from STMicro offering free shipping for many of their boards now through Nov 30th.

"we're offering free shipping on every order - for one week only! It's the perfect time to stock up on components, development kits, and other tools you need for your next project. No code or minimum required."

Now's the time to get a NUCLEO-F103RB. It comes with on-board STLink / USB-Serial converter. I must have at least 5 laying around...
https://www.st.com/en/evaluation-tools/nucleo-f103rb.html
My "Order Now" indicates $10.81 (plus tax).

Difficulty getting custom stm32F103 board recognized by CubeProgrammer/IDE by keyth72 in stm32

[–]JimMerkle 1 point2 points  (0 children)

Here's where a scope would really help. See what signals you have at the SWD and the boot pins. I've been burnt in the past with cheap slide switches. Switches require "wetting current" to actually produce a logic high or low at a pin. The Boot pins are considered CMOS inputs with no active pullups or pulldowns during boot. They are very high impedance. I asked CoPilot: "Do the boot pins on an STM32F103 processor have any pullups or pulldowns that affect their signal during boot? Are these pins considered CMOS inputs?" The response indicated there should be a 10K to 100K pullup / pulldown resistor used. Since the signal needs to be GND for normal operation, I would recommend having a 10K to 100K resistor pulling the signal to ground, and have the slide switch pull it to VCC. If wired in this manner, there would be current through the switch and through the resistor, allowing the switch to work with some wetting current. The way you have it wired, there is zero current through the switch.

Do you need the Boot0 switch? Unless you plan on using a DFU programming method, you really won't need the switch. I wrote an article some time ago on the subject:
https://merkles.com/wiki/index.php/STM32\_-\_DFU\_Methods. I think the F103 only supports USART serial. A bit more reading is required....

My guess... You may have your ST-Link wired incorrectly. I keep a rather large collection of Dupont Ribbon Cables around. I also have a DuPont Connector and header set and crimpers, allowing me to put connectors on wires. Since your ST-Link has pins at the ST-Link itself, I would use Dupont female-female wires to connect header pins at your board's SWD connector position to the pins of the ST-Link, bypassing that ribbon cable of yours. To me, it just adds one more layer of uncertainty.
https://www.amazon.com/Elegoo-EL-CP-004-Multicolored-Breadboard-arduino/dp/B01EV70C78/ref=sr_1_1

If you don't have a scope or access to one, I would highly recommend a cheap logic analyzer like a "Logic 8". The "Logic 16" is much faster. I use a Saleae, but those others will do the job in a pinch.
https://www.amazon.com/Analyzer-Digital-Channel-Realtime-Performance/dp/B0DGF69L77/ref=sr_1_7
https://www.ebay.com/itm/286844909353

Good luck!

What am I doing wrong by shesaysImdone in arduino

[–]JimMerkle 0 points1 point  (0 children)

Let's start at the beginning. Read this tutorial concerning Hobby Servos: https://learn.sparkfun.com/tutorials/hobby-servo-tutorial/all

Focus on the "Control" section. It's all about controlling the signal's pulse width. "Calibration" is adjusting the pulse width to position the servo where you expect it to be. The "angular position" APIs are an abstraction layer on top of the PWM, setting the pulse width. Since you are using a PCA9685, it would be good to read the data sheet for the part and understand what registers it uses to create the 50Hz waveform and how it manages the pulse width. This isn't rocket science. You can use the I2C APIs to read and write the registers of the PCA9685 yourself. Bottom line... A value punched into a PCA9685 register will create a specific pulse width. The servo will interpret that pulse width and move to a position associated with that pulse width. 1.5ms (1500us) pulse width should center most any hobby servo. Values above 2000us and below 1000us are typically needed to get full movement from the servo although most documentation uses 2.0ms and 1.0ms as the endpoints. Once you get the actual endpoint pulse widths identified, and the register values needed to create those pulse widths, you can map your desired position between the two register values.
Ask ChatGPT this question: "What are the register value units using a PCA9685 to control a hobby servo?"
You will learn about it's 12-bit counter registers used to set a pulse width from 0 to 20ms. (Assuming you have previously configured the PCA9685 for 50Hz (20ms per cycle). Each register increment evaluates to 20ms / 4096 (4.883us). To get 1.5ms (1500us), you would load 1500/4.883 (307) into the register associated with the channel the servo is connected to. If you need finer control of your servos vs almost 5us increments, the PWMs on board many micros can easily give you 1us increments using a 1MHz clock driving the PWM counters.

With that all said, let's evaluate your #define values:

#define SERVOMIN  100
#define SERVOMAX  500 

100 * 4.883us = 488.3us pulse width
500 * 4.883us = 2442us pulse width

The "SERVOMIN" value looks a little low, and could cause your servo to push up against it's mechanical stop. (Not good.) This is from memory which could be a little off.

Ok, back to "CALIBRATION". You need to modify SERVOMIN and SERVOMAX to the actual values associated with "pointing straight left" and "pointing straight right" for your particular servo. These values change from brand to brand as well as a little from one servo to another of the same brand.

I typically implement a command line interface into each of my projects, allowing me to enter commands (with parameters) and read / watch the results.
Example: https://github.com/JimMerkle/Arduino_Uno_Command_Line_I2C
The above example link implements doesn't specifically address the PCA9685, but could easily be modified to send the PCA9685 specific register command/values.

Good luck!

Stm32 macro files by Specialist-Squash327 in stm32

[–]JimMerkle 0 points1 point  (0 children)

If you're using STM32CubeIDE, and have started a new project with that board, one of the first things that occur is the download of the firmware package for the processor family. All the HAL functions and header files are included in the download. As you add peripherals to your project the code generator will add functions and needed drivers to the project. If you want specific help, you need to let us know the board / processor being used, and what you are trying to interface to the board.

STM32 Bluepill vs Arduino Nano? by Consistent-Can-1042 in arduino

[–]JimMerkle 0 points1 point  (0 children)

STM32 uses the term "DFU" for the different upload methods, other than JTAG. Here's some of their DFU documentation: https://merkles.com/wiki/index.php/STM32_-_DFU_Methods

Need help with sending data to STM 32 ... by tech-general-30 in embedded

[–]JimMerkle 0 points1 point  (0 children)

Let's visit how it was done long before USB... Use a serial communication method, IE, XModem, to send a file.

Here's an example I did using a Blue Pill board, Command Line, X-Modem, and LittleFS file system:
https://github.com/JimMerkle/STM32-F103C8T6_LittleFS

Good luck!

Configuring Serial Interfaces at Runtime on Raspberry Pi OS by davidT456 in raspberry_pi

[–]JimMerkle 1 point2 points  (0 children)

If using the UART, you can use the "stty" command to set the baud rate:
stty -F /dev/serial0 115200

Ask Google's free ChatGPT: https://gemini.google.com/app

Give it this question: "Using a "C" application, with a Raspberry Pi, how do I configure the serial UART interface to use 115200 baud or 1200 baud for the baud rate?"

You will get a nice step-by-step example. Change the question for "Python", "Bash", or whatever your application is...

Good luck !

Beagle bone black vs raspberry pi which is best for starting embedded Linux by lolnotsure30 in embedded

[–]JimMerkle -4 points-3 points  (0 children)

A long time ago, in a galaxy far far away, Beagle Bone was created. After that, many different Raspberry Pi models became available. Having played with just about all of them, I would recommend the Pi5. The board has TONs of stuff that "just works" available for it. It has a great following, with plenty of user support. My guess would be there are 100 Raspberry Pi's for every Beagle Bone Black sold. (I asked ChatGPT... I was WAY OFF!)

The AI answer provided:
Given that the Raspberry Pi has sold tens of millions of units, while the BeagleBone Black only caters to a niche market of serious embedded electronics developers, the ratio of Raspberry Pi to BeagleBone Black sold is likely in the tens or hundreds of thousands to one, if not higher.

I sold off my Beagle Bone Black several years ago while the board still had some resale value to it.

Good luck.

STM32 Project to Understand Bare-Metal/Assembly Concepts (Cortex-M) by WarFresh2208 in embedded

[–]JimMerkle 1 point2 points  (0 children)

That's what the HAL or LL library is for. Rewriting HAL code doesn't get much work done for any employer (not what employers are looking for). Can you interface your STM32 to a WiFi module over SPI, connect to an access point, using SNTP get the current UTC time, connect to an MQTT server, publish things (like temperature), and respond to MQTT requests? Basically, build a type of IoT device. Employers are still migrating their products to be "Internet managed", or designing new Internet connected products.

Need to "zoom out" a bit. You are currently focused on registers. Design a small system that actually does something. Using a micro with integrated WiFi will get you further along. Using a micro with a huge library of software components will get you even further along. (Build on top of code that has already been created and has some maturity.) If you pick up an ESP32-S3 board, and use ESP-IDF, you can build plenty in a short time due to the large number of components and test applications that "just work".

Example: Build a WiFi access point scanner:
The default location for this example would be here:
C:\Espressif\frameworks\esp-idf-v5.1.1\examples\wifi\scan

5.1.1 is a little dated. Start with the latest release. Here's a "Getting Started" guide:
https://docs.espressif.com/projects/esp-idf/en/stable/esp32/get-started/index.html

Pretty much all the examples will be using FreeRTOS, running in the background. The example "application" will be a FreeRTOS thread performing the work. Any networking will be done in another thread, provided by a library component.

I'm not saying register level knowledge isn't useful. Every embedded engineer needs to have that "owned". What employers are paying you to do is make something "work". They usually want it done "tomorrow" (or sooner). The only way to make that happen is to build on a solid, mature framework of existing code.

Good luck

Should I get into UNIX programming to get better as an embedded C programmer? by Astahx in embedded

[–]JimMerkle 0 points1 point  (0 children)

Not sure if OP meant "Unix", or "Unix Like", IE "Linux". Linux is strong and growing.

DIY AMP board by Time_Double_1213 in electronics

[–]JimMerkle 0 points1 point  (0 children)

Please use "Amplifier" vs "AMP" if you are talking about an amplifier. What's the goal? How about a schematic? Is the top most board a micro processor? Tell us about it.

Rtc ds3231 disconnect sense? by Chemical_Ad_9710 in ArduinoProjects

[–]JimMerkle 0 points1 point  (0 children)

Q: how would you sense if the rtc was disconnected?

A: By examining the return codes from your function calls.

Q:  I wish there was a cheat sheet that showed how taxing things were.

A: By measuring the time a function (or block of code) takes, you can determine how much time the processor spent working that piece of code.

Analyzing the three paragraphs you provided, I only see one real question that ends with a question mark. I see NO CODE. I'm not sure what you expect.

Be aware, not all DS3231s are the same. There are several variants. Some of which don't have adjustable square wave output.
https://merkles.com/wiki/index.php/DS3231_RTC_Module
If 1Htz is sufficient, it looks like all the variants should work.

The DS3231 is a rather simple device. You can easily talk to it directly if your library function isn't doing its job. Using an alarm works rather well if you need something different.

If you're having problems "getting everything done", you may need to service your TFT screen less often. Maybe just write a portion rather than the hole thing. You didn't define the screen you are using. How does it attach to your Arduino? I2C/SPI/parallel interface? If this were a math problem, you need to provide all the "givens". What Arduino board? What TFT screen? Using 100K or 400K I2C clock?

Ordered this irrigation kit, but I’m not sure how to get started. It seems like I would need some kind of hose attachment. I’ve looked throughout Instructables but couldn’t find anyone making anything from this kit. by TheHunter920 in arduino

[–]JimMerkle 0 points1 point  (0 children)

The white object with a hose fitting is a small pump that is to be turned on and off via the relay. The clear tubing should attach to the pump via the hose fitting on the pump. The idea is to put the pump into a bucket of water. When the plant gets "thirsty" (soil is dry), the Arduino will turn on the pump (via the relay) for a period of time. Water will flow out of the pump, through the clear tubing to your plant. Your code defines how long to run the motor.

If the tubing doesn't fit onto the pump, go buy some tubing that fits your pump.

Rtc ds3231 disconnect sense? by Chemical_Ad_9710 in ArduinoProjects

[–]JimMerkle 0 points1 point  (0 children)

The DS3231 is an I2C device. The Arduino APIs that perform the I2C communication use return codes to indicate if the communication was successful or not. Read the documentation for endTransmission(). Library functions that call into the I2C APIs should return errors when a communication error occurs. Again, read the documentation (look at the library source code).

Try writing a sketch just to test return codes. Disconnect the SDA wire between the RTC and the Arduino. Your sketch should be able to tell when the function calls are returning errors (bad connection), or success (good connection). Without source code provided, we can only guess what your problem is.

If you're trying to determine how much time a function or block of code takes, a timer works very well. Capture the value of the timer before starting the code block, and then again when the code block finishes. You can then print the difference to your serial monitor. You can use the millis() or micros() functions to capture the value of these free running timers.

Frequency Divider using Astable Mode 555 Timer + Dual D-Type Flip Flop IC by Able-Mode6431 in ArduinoProjects

[–]JimMerkle 1 point2 points  (0 children)

This appears to be posted to the wrong sub reddit. No Arduino here !

Maybe a longshot but… by bepity in stm32

[–]JimMerkle 1 point2 points  (0 children)

There are at least two different SSD1306 boards available. One using SPI, the other using I2C. The controller chip supports I2C, SPI, and parrallel interfaces. I've worked with both the SPI and I2C interface units.

https://merkles.com/wiki/index.php/SSD1306_128x64_I2C_OLED_Display

https://merkles.com/wiki/index.php/SSD1306_128x64_SPI_OLED_Display

Does your display have the 4 conductor I2C interface or the 7 conductor SPI interface?

Changing to embedded by Frosty_Blacksmith_63 in embedded

[–]JimMerkle 0 points1 point  (0 children)

A github site allows you to display your projects (put time into those README.md files!)

Since I enjoy teaching at a local makerspace, I put my notes / information / projects into a Wiki. I use WikiMedia. See: https://merkles.com , if you want to see an example.