8

The main difference is the bit before the -. That is, the 328 vs the 328P. The "P" there denotes "Picopower" which allows the chip to run at very low power consumptions. Basically the P version is a more modern version of the non-P chip. There are probably other internal differences too but you will have to check the datasheets thoroughly for those. ...


6

There are SRAM ICs / boards, however, don't expect 100 MB, more like 1 MB (with the pin numbers and connectivity / protocols that an Arduino offers). With Flash you can get much further, but it can only be written a number of times; not sure if that suits your requirements. Beyond that, I'm afraid the real problem is in the processing speed. Mixing 100 ...


6

The answer needs to have multiple parts: Yes, in principle you can create a bootloader for any microcontroller, which acts like the Arduino's. Please be aware that there are different bootloaders, not just the common STK500 compatible one. Each of these bootloaders implements a certain protocol to transfer the binary code to the target system. ...


3

There are three die types: 328 328P 328PB all have different signature bytes which may or may not impact loading code into them. Generally tho the programming software needs to know which part type is being used, at a minimum for installing bootloader code. Serial downloading may end up ignoring the signature bytes of a bootloaded part. They can be had ...


3

You have ATmega328P-AU. Classic Uno with DIP socket has ATmega328P-PU. Arduino Uno SMD has Atmega328P-MU. The automotive versions ATmega328P-15AZ and ATmega328P-15MZ have separate datasheet starting in Revision History with Creation of the automotive version starting from industrial version based on the ATmega48P/88P/168P/328P datasheet 8025F-AVR-08/08....


3

In the case, that this is a school assignment and you actually have to program directly in assembler, you probably don't want to directly convert your C++ sketch. It will generate way more assembler code, than is really necessary for alternatively blinking two LEDs (for example digitalWrite() contains not only the actual writing to the corresponding pin ...


3

The compiler cannot detect a missing ISR since it is very difficult, in the general case, to tell whether any particular interrupt-enable bit has been set by the program. The avr-libc library does indeed provide a “catch-all” ISR and, as stated by the manual, the default action is to reset the device by jumping to the reset vector. If you don't like ...


3

The bits within a byte are numbered 0 through 7 from right to left. The rightmost (least significant) is bit 0, next is bit 1... and the leftmost (most significant) is bit 7. The expression _BV(3) builds a byte where bit 3 is set (is 1) and all other bits are clear (are 0). In binary it looks like this: position: 7 6 5 4 3 2 1 0 bit value: 0 0 ...


3

ATTINY's are designed to easily do this since they can wake from power down sleep mode by a pin change... Basically you want to... Connect a normally-open push button between an IO pin and ground. Enable the pull-up on the IO. Enable the pin change interrupt on the IO pin. Enable interrupts. Enter "power down" sleep mode. When the button is pushed, it ...


3

You can reuse everything what is not damaged, but it can be tricky to properly desolder multi-pin SMD parts. It's hard to verify if a processor is still working, but it propably is not anymore if you applied a too high voltage on one of the input pins or drew to much current. Parts like regulators are always handy. I would skip capacitors and resistors. ...


2

Can I manually jump to an ISR regardless of its "normal" trigger? This should be possible, but is probably not the best solution. This is certainly an X -> Y problem, so I'm open for other approaches. It would seem you are using the timer in CTC mode. In this mode, when you write to OCRxA, the register is updated immediately, which leads to the ...


2

No, this is not possible. The datasheet of the ATmega328P states it has: 8-channel 10-bit ADC in TQFP and QFN/MLF package 6-channel 10-bit ADC in PDIP Package If you want to use a bare chip, it won't be possible with a PDIP package.


2

You wrote: Using [...] the atmega's hardware pwm is not very suitable because I need two 50/50 square waves with a phase difference of pi I believe hardware PWM is the best solution to your problem. The PWM outputs can be set to either “inverting” or “non-inverting” mode. Set the two channels of a single timer to the same duty cycle, with one in non-...


2

what exactly is it that makes a simple function like digitalWrite() so damn slow??! Why isn't it just a wrapper function for direct port manipulation? Well, it can take a variable as an argument. And the contents of the variable have to be looked up in a table to see which port and which bit. If you use the DigitalWriteFast library then that turns your ...


2

Use the https://github.com/MCUdude/MiniCore for ATmega328. It has Boards Manager installation. Choose the right options in Tools menu for your ATmega328. First burn the bootloader using programmer or "Arduino as ISP". Then you can do serial upload as usual. You can put the ATmega328 on Uno if you want.


2

I can see you are on Linux so I won't give you instructions for using AVR Studio - but do know that if you have access to a Windows machine that is another option you could try. I can't tell you exactly why it is not working through the Arduino IDE - it could be that the settings are not set correctly or any number of reasons. What I can say is that it is ...


2

There are also a couple of ways of including assembler code right inside your Arduino IDE. By including the assembler in the Arduino IDE, the assembler source is assembled and linked into your project and uploaded to your Arduino from within the IDE - just like any other program. This makes it easy to get started with Assembler while still retaining the ...


2

To upload compiled code (.hex) to a bare atmega which doesn't have a bootloader installed you can use ISP. As this stands for in-system-programming you don't have to flash the chip before assembly, but you can flash it in-system, so when already soldered onto your pcb. There actually is no need for those adapters like shown in your first picture, which often ...


2

You need a programmer to burn fuses. If you have another arduino then you can use the Arduino as ISP example sketch in the IDE. You can't burn fuses just using the USB cable like you upload code with. The only reason that can talk to the chip at all is because there is another chip to convert it to serial and a bootloader on the 328P to allow it to upload ...


2

The Arduino builder creates for AVR boards not only hex file for the sketch, but it creates a combined hex with bootloader and sketch too. It is for example for Blink.hex a Blink_with_bootloader.hex. If you use in IDE the "Export compiled binary" command in Tools menu, the builder puts the hex files next to ino file in your sketch folder. If you want the ...


2

I tried the code on an Uno and as you say, it does sound odd. By my calculations, the frequency is 40kHz (16MHz/(200 x 2)), which is above the threshold of hearing. The sound we are actually hearing is probably the 3rd or 5th harmonic, at a reduced intensity and perhaps subject to jitter. I tried changing TCCR2B = _BV(CS20); // clk/1 to TCCR2B = _BV(...


2

A CPU or MCU uses very basic instructions which are executed. If you write code in a program language (like in Arduino IDE), the sketch is converted into many instructions (by the compiler and linker). The instruction set can be found here. An example is: ADC Rd, Rr: Adds two registers and the contents of the C flag and places the result in the ...


2

As others have said, the difference between 1023 and 1024 is quite small. However, the fact is that your input range for the ADC is 0 to 1023. (That's 1024 steps, but since it starts at 0, it won't go up to 1024) You'll get 0 at the minimum input, and 1023 at the maximum value. If you're using a 5.0V reference voltage and no voltage dividers, that means ...


2

the Atmega328P's datasheet, it indicates the conversion factor is 5V/1024 [...] Indeed. And the datasheet is the only authoritative source. All the other sources are second-guessing. If Vin and Vref are 5V, then the ADC reading would need to be 1024 in order to have a true reading of 5V You can't get a true reading of 5 V. As per the datasheet (...


2

This might help you alot The ATMega328 is 8bit AVR microcontroller with a wide variety of things, in order for this IC to work it's essential to have a "Clock Source".as default of Arduino UNO it uses a 16MHz Crystal oscillator with two 22pF capacitors in order to generate the clock signal so, if you took the ATMega328 from the Arduino and put it in a ...


1

You are using Timer/Counter 1 in Fast PWM Mode with TOP set to OCR1A: OCR1Aonly describes the number to what it counts up so, 0…391 in your case. You have to define the duty cycle with OCR1B. 50% would be 195.


1

It seems that you are using too high programming speed. SCK period al of 0.1 us renders 10 MHz, which is to fast if crystal is working at 8 MHz. Not sure where to change it in Arduino environment, but you should add this key to avrdude.exe run string: avrdude.exe -B 8 This will set programming speed to 125 kHz. Also I suggest you to buy a cheap USBasp ...


1

1KB is 1024 bytes, not 1000 bytes. Therefore 32kb = 32768 bytes. 32768-512=32256, which is exactly the value used for upload.maximum_size for the 328p. 4kb=4096 bytes. 32768-4096=28672 which is the value for the 32u4.


1

I'd also suggest looking into different microprocessors. The Teensy models often have an SD card socket, and the Teensy 4 (especially if they release one with a built-in SD socket) is extremely fast and capable (600MHZ, dual instructions/cycle). That would be far better suited than an Arduino, though you'll still have RAM limits. (Nowhere near 200 megs, but ...


1

You can temporarily put it in an UNO. Don't connect this UNO via USB, but use jumper wires to connect the ISP pins plus the power pins to the other Arduino that you are using as an ISP programmer. (You could also use the (2x3) ISP header on the UNO if that's more convenient.) Or, you could use a high voltage programmer. Or get/desolder a crystal from some ...


Only top voted, non community-wiki answers of a minimum length are eligible