New answers tagged

0 votes

Custom Memory Allocator - How to find the required alignment for a platform?

malloc is required to return a pointer properly aligned to hold an object of any type. Which means it must be aligned at least as the largest scalar type. Luckily C ...
user avatar
  • 9,612
0 votes

Why are some embedded registers password protected?

Note something other people have not addressed: the watchdog is not a strong defense against a (very) buggy firmware. It is meant as a last ditch resort against two scenarios: First and foremost: some ...
user avatar
1 vote

How is the CQFP64 package supposed to be soldered?

This document explains how to mount CQFP packages, and includes photographs showing the various stages. They recommend using lead forming tools by Fancort Inc to trim and form the pins for the ...
user avatar
  • 235
0 votes

What does the diode do in this LSO (Low side output driver)?

When the load stores energy (inductive) , the diode continues the current as the voltage is clamped just at the diode drop @ that instant current above the supply. This diode clamp -only tends to be ...
user avatar
0 votes

What does the diode do in this LSO (Low side output driver)?

The diode protects the FET when driving inductive loads. Current in inductor cannot be stopped immedately as the collapsing magnetic field will keep pushing current into the FET drain, and there is no ...
user avatar
  • 89.6k
1 vote

What does the diode do in this LSO (Low side output driver)?

It's a clamp diode. It clamps the reverse voltage across the load to one diode drop Vf and clamps the MOSFET source to no higher than Vbatt+Vf. In this case the cause of such a reverse voltage is ...
user avatar
  • 47.1k
0 votes

What does the diode do in this LSO (Low side output driver)?

The diode is a fly-back diode. If the load is inductive, simply turning off the ground to it will cause the inductive load to attempt to continue to drive current (since inductors do not like to ...
user avatar
  • 634
3 votes

What does the diode do in this LSO (Low side output driver)?

If your load is inductive (even a little bit), the back emf created by that inductance will splash a big impulse of voltage onto the MOSFET drain when the MOSFET de-activates. The diode will "...
user avatar
  • 384k
11 votes
Accepted

How is the CQFP64 package supposed to be soldered?

There's really not much documentation on the CQFP64. I found a document with all the dimensions of many CQFP variants, but I couldn't find anything about actually using them. I did find an example of ...
user avatar
  • 58.4k
4 votes

How is the CQFP64 package supposed to be soldered?

Can the golden frame and ceramic slab be removed before soldering, or should the pins be cut and bent onto the PCB? Normally no. Flip it over and it'll be ready to be surface-mounted (Atmel print ...
user avatar
11 votes

Why are some embedded registers password protected?

Pretty much every watchdog peripheral I've ever worked with requires that an unique number sequence is written to the register on regular basis. In case you write the wrong one, the MCU will reset. ...
user avatar
  • 14.2k
-1 votes

12V solar panel voltage is not 12V in reality. How do I correct this? (ESP32 solar powered project)

When a battery is connected to a solar panel, the solar panel voltage is the battery voltage. This is a characteristic of electrical systems. When you connect things together, they have one voltage. ...
user avatar
  • 4,096
0 votes

Need an IC that can produce a HIGH output with a sink or source input

This input stage accepts industrial NPN and PNP sensors or switches, the output is active low. simulate this circuit – Schematic created using CircuitLab The unconnected input provides 4.4 V ...
user avatar
  • 1,954
5 votes

Why are some embedded registers password protected?

A similar mechanism is used on newer AVRs (XMEGA and related), though not with a watchdog integrated mechanism. The CCP (Configuration Change Protection) simply does nothing if the sequence fails. ...
user avatar
  • 2,813
22 votes
Accepted

Why are some embedded registers password protected?

These registers have a disproportionally significant effect on the device's reliability, and likewise on the reliability of the surrounding system that the device is integrated in: The watchdog timer ...
user avatar
  • 14k
20 votes

Why are some embedded registers password protected?

The job of the watchdog is ensuring that your software still runs, not that something that just randomly overwrites memory (e.g. a buffer overflow, or plain, an addressing bug) among many other things ...
user avatar
9 votes
Accepted

What is the use of a P-channel FET on a power line?

The FET is there for reverse polarity protection. When the power is first applied, since the FET's source node doesn't know what voltage it has, the FET remains off for a moment. The body diode is ...
user avatar
0 votes

Need an IC that can produce a HIGH output with a sink or source input

If the Output is programmed as "Output" ... This is going to be your problem. There is no way for the I/O level converter to know whether the its driving signal is an OUT from the ...
user avatar
  • 160k
0 votes

Need an IC that can produce a HIGH output with a sink or source input

Industrial I/O is quite a strange beast. In fact, as far as I know, an universal NPN/PNP input (they are called that way even if they are not done using BJT) is not even provided for in the IEC 61131-...
user avatar
1 vote

NTC sensor in a Wheatstone bridge

There are many choices/tradeoffs to making a linear wide range (140'C) thermal sensor. First and foremost decide on your budget and tolerance error. The tradeoffs include 1kB memory for Look Up Table ...
user avatar
0 votes

NTC sensor in a Wheatstone bridge

An NTC is a nonlinear device. Linearizing it in analog electronics is very hard, because the things you could use to linearize it depend on temperature, so that your measurement gets worse. However, a ...
user avatar
2 votes

How do I detect a button press between MCU loop function calls?

One solution is to use an interrupt; connect all buttons to the same interrupt pin on the MCU, which triggers the code to poll the shift register. Thanks to @Andyaka in the comments for this idea. ...
user avatar
0 votes

Why can't an MCU's GPIO pins directly control power MOSFETs?

Others have already explained the 'why not's, so I'd add the 'BUT' part. For simple applications(*), with reasonably modern parts (**) and with a 5V micro (***) you certainly can build something that ...
user avatar
  • 249
0 votes

Is it possible to interface a 50 V DC analog sensor with an Arduino?

If the output is just a voltage reference you can do a voltage divider to step down to the Arduino input ADC voltage.
user avatar
0 votes
Accepted

Are these MOSFETs wired correctly?

One problem is the supply switch of the water-level sensor. You can turn off the sensor by disconnecting GND of the sensor as your circuit shows. But if you do so, the positive supply is still present ...
user avatar
  • 1,954
0 votes

Why does powering up my PCB with 12 V without GND connected burn out my controller?

Is there a way to prevent this from happening? Just ensure grounds are connected and check each IO line with a scope/meter before connecting to your controller. If necessary protect your controller ...
user avatar
  • 384k
1 vote

Is there any MPU where the watchdog has its own clock?

From the discussion in the comments there also exists "clock watchdog" implementations in some IC's, take for example Microchips "Failsafe Clock monitor": Source from their ...
user avatar
  • 837
4 votes
Accepted

Is there any MPU where the watchdog has its own clock?

It is reality. This feature is often implemented in microcontrollers. Just as an example, the atMega328 has a separate 128 kHz low frequency oscillator for the hardware watchdog. The datasheet says: ...
user avatar
  • 1,954
0 votes
Accepted

Facing problem to download Hex file to STM32 using Command line

I would say that your program starts at 0x08001000 probably because of a bootloader so if you want to see what you wrote you have to start reading from that point because you are showing a few bytes ...
user avatar
  • 274
1 vote

Microcontroller requirements for multiple Modbus controllers

MCUs with 4 UARTs uncommon and expensive? That is not true. Using a manufacturer search tools I find cheapest and smallest MCU with 4 UARTs cheaper than a dollar in production quantities. In practice ...
user avatar
  • 89.6k
17 votes
Accepted

Why can't an MCU's GPIO pins directly control power MOSFETs?

Sometimes they can. But when they can't there are two main reasons- not enough voltage and/or not enough current. The voltage is required to get many MOSFETs to turn on so they have low resistance. ...
user avatar
1 vote

Microcontroller requirements for multiple Modbus controllers

Max number of devices on one Modbus data link ... one Modbus can handle 32 sensors, I think. Wikipedia: Modbus is restricted to addressing 247 devices on one data link, ... Looking for a right MCU ...
user avatar
7 votes

Why can't an MCU's GPIO pins directly control power MOSFETs?

Because they are electrically incompatible. If you have a MCU with 3.3V IO voltage, it is possble that N-FET requires more than 3.3V at gate to turn on properly. If you have a P-FET and the supply at ...
user avatar
  • 89.6k
1 vote

Microcontroller requirements for multiple Modbus controllers

You might want to take a look at the RP2040 by the folks at Raspberry Pi Tough it only sports 2 UART you can add more by using the Programmable IO (PIO) cores to create more UART as you need them. ...
user avatar
  • 1,581
10 votes

Why can't an MCU's GPIO pins directly control power MOSFETs?

The MOSFET gate turn-on voltage may be higher than what an MCU I/O pin can provide. A driver circuit can translate the I/O logic output voltage into a strong 'on' gate voltage. A MOSFET drive circuit ...
user avatar
  • 17.9k
1 vote
Accepted

12V solar panel voltage is not 12V in reality. How do I correct this? (ESP32 solar powered project)

Yes, you need a "charge controller", but a specific type -- a MPPT charge controller. MPPT = Maximum Power Point Tracker. From googling MPPT, "An MPPT, or maximum power point tracker ...
user avatar
1 vote

Reset on lockup, by discrete analog components

You are describing a kind of watchdog timer. We have that function built into microcontrollers and discrete chips which perform that function autonomously. Generally they just pulse a reset input (or ...
user avatar
0 votes
Accepted

Microchip CanBus Bootloader J1939 - Multiple devices programmed in parallel

Running a bootloader while other, powered devices are present on the J1939 bus means that your bootloader has to be implemented according to J1939 standards, not after some generic Microchip ...
user avatar
  • 14.2k
1 vote

Is it possible for two MCUs to monitor the same analog voltage signal?

In principle there is no issue provided the source can drive both inputs without excessive error. There are not a lot of valid reasons to do this in a new design (as opposed to something being tacked ...
user avatar
1 vote

How to calculate the scale factor of non-linear ADC output value?

So you have a scale and zero error. V = 1.019*ADC_READING + .047mV, based on the points above. Chances are the best gain factor is somewhat different from 1.019- to get an accurate factor, pick points ...
user avatar
2 votes

How to power two ESP-01S chips from 220 V AC

Be aware to know the complete specifications of the supply of ESP-01. from this link. And for the need of only supplying ESP-01S, I choose some SMPS converters (google it "AC 220V 230V to DC 3....
user avatar
  • 4,942
0 votes

ESP8266 inverted output from NVR alarm

A direct connection from NVR alarm LED driver to ESP8266 digital I/O input is possible only if the GND of one connects to GND of other. It is assumed that both NVR and ESP8266 are powered with a DC ...
user avatar
  • 18.4k
2 votes

Noise reduction algorithm for an AC mains voltage measurement

I am sampling the 50 Hz sine wave at 20 points Depending whereabouts the first sample lies and the 20th sample lies on the sampled waveform, can produce errors of this magnitude. A much higher ...
user avatar
  • 384k
1 vote

How to power two ESP-01S chips from 220 V AC

You can use a "wall wart" USB power supply with an LDO or buck regulator, or a power supply module, like this MeanWell RS-15-3.3 : It is preferable to source it through an authorized ...
user avatar
2 votes

How to power two ESP-01S chips from 220 V AC

The 2 most important rules of small/hobby electronics: Don't mess with AC mains power. It will kill you. * Don't reinvent the wheel. It will frustrate you and waste your time. src ** Now you only ...
user avatar
2 votes

SPI MISO line not working

One classic mistake is that when you connect two live, supplied boards and the TTL level signals connect before ground pins, something else might become ground temporarily, resulting in wrong voltage ...
user avatar
  • 14.2k
1 vote
Accepted

Can VCC be supplied by external power supply?

This is where the standby regulator is needed. And a good example is ATX PSUs: In ATX PSUs there's a separate standby regulator (mostly a flyback) which gets its input from the output of the PFC pre-...
user avatar
0 votes

Impedance problem on MCU ADC input line

It sounds like you've introduced an offset due to layout, specifically voltage drop across traces. Depending on what you are using as a reference, that drop could be as low as 1.7mV/LSB. I presume you'...
user avatar
1 vote

Controlling 0-5V from 0-3.3V PWM pin and 5V power

Use PWM. Connect the transistor in a common emitter configuration, with emitter connected to ground, base connected via a 4k7 resistor to GPIO, and collector collected to the cathode (-) of the LED ...
user avatar
1 vote

How to filter EMI noise from DC motor between LCD and microcontroller?

Well, many antennas close together. The only display signal input, that can cause data to be written, is the E (Enable) input. It is the clock of the transfer. So, it's likely, that this wire receives ...
user avatar
  • 1,954

Top 50 recent answers are included