Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »

Activity for Carl‭

Type On... Excerpt Status Date
Comment Post #296601 Thank you for the links. I’m cautious with books about programming because I’m not able to tell good practices from bad. Or in other words, high quality code vs low quality. With books on electronics I can easily tell garbage from gold, but not so much with programming.
(more)
20 days ago
Edit Post #296601 Initial revision 21 days ago
Question Error handling in embedded systems
How do I handle errors in my embedded system? I have learned that it is a de facto standard for driver functions to return an error code that reveals if the function fulfilled its main purpose or if it encountered an error. If we take a look at the switch-case construct in Lundin's state machine ...
(more)
21 days ago
Comment Post #296584 Hi again Lundin. I cannot seem to grasp the purpose of opaque type `typedef struct can_msg_t can_msg_t; ` declared in the canhal.h. I see you use it in the function prototypes where you accept a pointer to a `can_msg_t`. I also see in your send sequence code that you use a `tx_msg` as input argum...
(more)
23 days ago
Comment Post #296580 Thank you for the update and response Olin. But I wonder, isn't this directly contradicting what @Lundin wrote here in his answer?: " ```C /* Check which port that was selected */ volatile Can* can_port = port; if(can_port != CAN0 && can_port != CAN1) { return CAN_ERR_INIT_HW; ...
(more)
23 days ago
Comment Post #296584 With regards to the init function, there is a way to infer all the necessary registers from just the port parameter. For the microcontroller I'm using, the USART registers for port 0 are UCSR0A (0xC0), UCSR0B (0xC1), UCSR0C (0xC2). USART port 1 shows same 1 byte offset in memory, so I thought of ...
(more)
24 days ago
Comment Post #296584 Thank you for your Answer Lundin. In terms of organizing and VCS, do you have a something like a separate git repository for your all your *hal.c and *hal.h, and then another git repository with all the driver code, with separate branches for separate MCUs?
(more)
27 days ago
Edit Post #296576 Initial revision 28 days ago
Question What exactly is a HAL and how would I write my own?
When I program STM32 microcontrollers I use ST's toolchain which provides all the tools necessary in order to build (and flash) the application binary. The toolchain also comes with ST's own library (source and header files) that allows me to control the micro's peripherals by using their functio...
(more)
28 days ago
Edit Post #296533 Initial revision about 1 month ago
Question How do I test firmware code for my embedded system that also controls hardware peripherals?
I am soon finished writing the firmware for a relay control board that will help us automate some of the electrical tests we run at the company I work. In essence, the board more or less just turns relays on and off by communicating with an external PC via USART - simple enough. The challenge I ...
(more)
about 1 month ago
Edit Post #296475 Post edited:
about 1 month ago
Edit Post #296475 Initial revision about 1 month ago
Question Communication with microcontroller via usart - using strings a good idea?
I have a PCB with an onboard microcontroller that I use to turn on and off a bunch of switches/relays. To control which relay should be on I use my computer to communicate via USART to the microcontroller, with a local python script sending commands. Right now, I have it set up such that my pyth...
(more)
about 1 month ago
Comment Post #295939 Is there a way to provide more safety when using these enums? For example, if I'm not paying proper attention it's easy to make a mistake where ``` coffee_result_t ``` and ``` coffee_state_t ``` enums are mixed, for example in the initialization of the state machine pointer array: ``` [COFFEE_NO_...
(more)
about 2 months ago
Comment Post #296367 Thanks for your answer Lundin. I will take your comment about 16 MHz being overkill to heart. And the principle of KISS. But even if I use the bidirectional 74LVC245, I still need to provide a signal for the DIR pin about which side is driving the SWDIO pin. And the question was more or less how ...
(more)
2 months ago
Comment Post #296358 Thanks for the update.
(more)
2 months ago
Comment Post #296358 Hi Olin, thank you for your ideas! I should have been more precise in my question, but I can only drive the signals from the JLINK side, not from the device side. Anyhow, I will try to implement the "always driving both ways" and see how it works. One last thing, could you briefly explain the "dr...
(more)
2 months ago
Edit Post #296355 Post edited:
2 months ago
Edit Post #296355 Post edited:
2 months ago
Edit Post #296355 Initial revision 2 months ago
Question Transceiver board for recovering pulse shape on SWD signals - avoiding bus contention on SWDIO
In the R&D section of the company I work for we use a Segger JLINK to communicate and program our devices. We use our own small "converter board" PCB to convert the JLINK 2x10 pin header connector to a mini DIN-6 connector that transfers SWDIO and SWCLK signals to our device using a CS44 cable. T...
(more)
2 months ago
Comment Post #295483 I agree, definitely off-topic. Thanks for the link! I will write on there later today.
(more)
7 months ago
Comment Post #295483 Hi Lundin, thanks for your enlightening answer. From your answers here and on EE.SE I can tell that you are an expert in electronics, particularly in embedded systems and C. I am very interested in embedded systems, but am currently working in a position as an EE where tasks regarding embedded pr...
(more)
7 months ago
Edit Post #295475 Initial revision 7 months ago
Question Cutoff frequency of lowpass filter for AVcc
The ATmega16U2 datasheet suggests putting an external lowpass filter from Vcc (the digital supply) to AVcc (the analog supply). Imagealttext However, the datasheet doesn't specify what type of lowpass filter (passive/active, RC/LC) should be used, neither does it specify the cutoff frequenc...
(more)
7 months ago
Comment Post #295313 If double row headers with ribbon cables aren’t suitable for relatively frequent insertion and removal, what is then a good solution?
(more)
8 months ago
Edit Post #295200 Post edited:
9 months ago
Edit Post #295200 Post edited:
9 months ago
Edit Post #295200 Post edited:
9 months ago
Edit Post #295200 Initial revision 9 months ago
Question How to use USB-B to power 5 V microcontroller and peripherals
I built a small breakout board of for an ATmega328p microcontroller. It included an AMS1117 5 V regulator and a CP2102 USB-UART bridge for programming and serial communication. On the board I use a USB-B receptacle to provide power, and for communication purposes. Both the microcontroller and the...
(more)
9 months ago
Edit Post #294739 Post edited:
11 months ago
Edit Post #294739 Post edited:
11 months ago
Edit Post #294739 Initial revision 11 months ago
Question Using local power and ground net to keep high frequency currents off global ground plane
I recently read the accepted answer here, by Olin Lathrop: Decoupling caps, PCB layout It talks about preventing an IC from acting as a center fed patch antenna by keeping the high frequency currents generated by the IC off the global ground plane. This is achieved by using localized bypassing...
(more)
11 months ago
Edit Post #294555 Post edited:
about 1 year ago
Edit Post #294555 Post edited:
about 1 year ago
Edit Post #294555 Post edited:
about 1 year ago
Edit Post #294555 Post edited:
about 1 year ago
Edit Post #294555 Initial revision about 1 year ago
Question Is using different valued bypass capacitors a cargo cult? Should I do it because that's what everybody else does?
A microcontroller can be modelled simplistically as a broad band current source/sink. For example, when the microcontroller wakes up from sleep mode and goes into an application mode where many of its pins need to be pulled HIGH, the waveform for the current that the IC draws from the supply look...
(more)
about 1 year ago
Comment Post #294163 I updated my question with some clarification, and an additional plot of my ECG in the time-domain.
(more)
over 1 year ago
Edit Post #294163 Post edited:
over 1 year ago
Edit Post #294163 Post edited:
over 1 year ago
Edit Post #294163 Post edited:
over 1 year ago
Edit Post #294163 Initial revision over 1 year ago
Question Noticeable dip in amplitude response at 50 Hz when shielding circuit with driven right leg network.
I have built an ECG amplifier that uses an instrumentation amplifier and a driven right leg circuit to attenuate 50 Hz common mode voltage stemming from the body. A portion of the circuit is seen below: Imagealttext I measured some very nice and low noise ECG signals without enclosing my ci...
(more)
over 1 year ago
Comment Post #293514 -1 for not answering my question at all. Don't think that because I just don't mention things in my question that I am not aware of them myself. Also, pictures without any explaining text are not helpful imo.
(more)
over 1 year ago
Comment Post #293480 Ag/AgCl electrodes used for ECG measurements have an intrinsic half cell potential of 223 mV, if the electrodes are completely new. If one electrode for some reason is more dry than the other, the difference between the half cell potentials for the two electrodes can maybe reach 100 mV. This caus...
(more)
over 1 year ago