Skip to main content
7 votes
Accepted

Weird behavior (Couldn't pull the pin LOW)

You are creating a pointer variable, not a normal variable. That pointer variable is, until told otherwise, pointing at address 0x00. It covers 4 bytes. Addresses 0x00 to 0x1F are the internal CPU ...
Majenko's user avatar
  • 105k
6 votes
Accepted

Where in datasheet is the warning about unreliability of reading PINxn?

did somebody come across such case, or I'm the first in the world? You are not the first. I recently got bitten by the very same issue. However, unless you are close to an unusually strong radio ...
Edgar Bonet's user avatar
  • 43.3k
6 votes
Accepted

Own type definition using a struct does not name a type

This is a bug in the Arduino IDE: when converting your .ino file to a .cpp file, it added a declaration for the function ledFactory() before the declaration of the type led_t. As it appears to be ...
Edgar Bonet's user avatar
  • 43.3k
6 votes

Why do I have to burn the code to make it run?

On a Unix shell, separating commands with the pipe character (|) means “run these commands in parallel, feeding the standard output of each one to the standard input of next one”. In this context, it ...
Edgar Bonet's user avatar
  • 43.3k
3 votes
Accepted

AVR-GCC can't call function located on fixed address

I've tried this code with arduino and it worked (i taught, of course, i can't add the "-Wl,--section-start=.app_start=0xFA0" flag to the compilation process so the function not gonna be moved to other ...
Dankó Dávid's user avatar
3 votes

Where in datasheet is the warning about unreliability of reading PINxn?

A test with an Arduino Uno. I used the usb connector to power-on the arduino uno. The led is at PB5, so I have exchanged PB0 and PB5. My test is therefor not the same. #define LED_PB PB5 // pin ...
Jot's user avatar
  • 3,246
3 votes
Accepted

Interleave disassembly + source with avr-objdump

The .stabs section contains debugging info, not actual code. There is no point in trying to “disassemble” it. The -D option of avr-objdump means “disassemble everything, whether or not you believe it'...
Edgar Bonet's user avatar
  • 43.3k
3 votes
Accepted

slower clock frequency than expected on attiny202

Just as a complement to chrisl's answer, if you disassemble the compiled program, you should see that your infinite loop looks like this: 1: sts 0x0407, r24 ; write to PORTA_OUTTGL rjmp 1b ...
Edgar Bonet's user avatar
  • 43.3k
2 votes
Accepted

avr-gcc -D is ignored

You are using $(CPPFLAGS) for *.cpp files but only $(CXXFLAGS) are defined. This should be obvious from command line (if you enable showing executed commands for make) And also: CC = using $(CPP) ...
KIIV's user avatar
  • 4,752
2 votes
Accepted

Volatile variable not updating from timer ISR

You want CTC mode for that to work. As in: #include <avr/io.h> #include <avr/interrupt.h> volatile uint8_t count; void init_100us_tick(void) { TCCR0A = _BV(WGM01); // CTC mode ...
Nick Gammon's user avatar
  • 38.4k
2 votes

Compiling code via terminal

Check out platformio.org it's the best solution out there for command line compiling.
Andre Courchesne's user avatar
2 votes
Accepted

programming arduino in pure c

In file included from led.c:3:0: /usr/lib/avr/include/util/delay.h:95:3: warning: #warning "Compiler optimizations disabled; functions from won't work as designed" You should start by fixing this....
Edgar Bonet's user avatar
  • 43.3k
2 votes
Accepted

How does the build process in Arduino IDE work for ESP8266

Does it uses same for compiling programs for esp8266 ?. No. It uses xtensa-lx106-elf-gcc. The compiler has to match the architecture. Most of the build "process" (as in the actions that are taken) ...
Majenko's user avatar
  • 105k
2 votes

Where in datasheet is the warning about unreliability of reading PINxn?

You have made an antenna with the 10cm wire and are receiving radio waves which is translating to voltages on your input pin. This is why you don't have the same trouble when the wire is not connected....
sa_leinad's user avatar
  • 3,188
2 votes

How would I include Arduino libraries using AVR-gcc without the IDE?

Since you will end up using a significant portion of the Arduino core library, the easiest path is to accept the idea that you are now writing “Arduino sketches” rather than plain C++ code. Don't ...
Edgar Bonet's user avatar
  • 43.3k
2 votes

Error compiling code for Arduino/Genuino Uno

The problem is just what the error message says it is. c:\users\hp\desktop\arduino-nightly\hardware\tools\avr\bin../lib/gcc/avr/4.9.2/../../../../avr/bin/ar.exe: unable to rename 'core\core.a'; ...
Code Gorilla's user avatar
  • 5,637
2 votes
Accepted

Error Compiling sketch for Arduino Uno(ld return 1)

This is a bug in the compiler (linker) used by the Arduino AVR Core. It's not because of a bug in your code, and there's not much you can do about it except using a different version of the AVR Core. ...
tttapa's user avatar
  • 1,320
2 votes
Accepted

C++ State Machine / Wpmf-convesion

A pointer to a member function is not allowed in C++. GCC can allow it, but moans at you because it's non-standard. In C++ the normal way of dealing with the kind of thing you want is through class ...
Majenko's user avatar
  • 105k
2 votes
Accepted

AVRdude does not read the FUSE byte values correctly

A couple of things. That you can't change fuses from the bootloader and that optiboot can't report fuse values correctly, even if you change them. No self-programming of fuses A bootloader can't ...
timemage's user avatar
  • 5,299
2 votes
Accepted

Why my arduino board does not blink properly?

There are a couple of issues here. One of them has already been raised in a comment: int main() { - ddrB = (port_type) 0x20; + *ddrB = (int8_t) 0x20; while(true) { The more ...
Edgar Bonet's user avatar
  • 43.3k
2 votes

How to pass non-static class member to callback on avr platforms?

You can't. On the AVR platform, PubSubClient::setCallback() expects a raw function pointer as a callback, and that is what you have to provide. A static method is equivalent to a raw function, a non-...
Edgar Bonet's user avatar
  • 43.3k
2 votes
Accepted

Do I need to use resisters and ICes for specific sensors.What if I dont use it,Will it impact my arduino board some how like making it useless &faulty

Both images, that you included, show breakout boards. They are circuit boards (PCB - Printed Circuit Board), which contain all the components, that are needed to connect the corresponding part (in ...
chrisl's user avatar
  • 16.3k
2 votes
Accepted

How do I build and upload a C++ program without the Arduino Library or IDE?

Create a new file called Makefile in your project directory. Populate it with the following contents: TEMPDIR := $(shell mktemp -d) all: avr-g++ -DF_CPU=<CLK> -mmcu=<PARTNO> -fno-...
glibg10b's user avatar
  • 317
2 votes

How to run avr-gcov on a .ino sketch file

Code coverage by "gcov" has some prerequisites: Instrumented code to count the number the control flow reaches certain points of the program. This is done via the options you tried. Linking ...
the busybee's user avatar
  • 2,088
1 vote
Accepted

compilation error when changing variable from char to String

This bug is specific to the 5.4.0-atmel3.6.1-arduino2 version of avr-gcc used by Arduino AVR Boards 1.6.22 and newer. It has been reported here: https://github.com/arduino/Arduino/issues/7949 Here's ...
per1234's user avatar
  • 4,178
1 vote

Atmega collecting and relaying interrupt calls

The answer i've accepted is the proper answer for the problem i asked. However replacing the C runtime requires to attach and maintain a lot of crt.S files oiginally related to the GCC. To avoid this ...
Dankó Dávid's user avatar
1 vote
Accepted

Atmega collecting and relaying interrupt calls

The interrupt vector table is provided by the C runtime. It is not normally intended to be overridden by user code. You can, however, do it, if you replace the whole C run time by your own, and ...
Edgar Bonet's user avatar
  • 43.3k
1 vote

DigiSpark AT Tiny85 compile problem?

I had similar problem. I removed functions loop() and setup() and I used classic C construction with main() function and it started to work. (I think loop() and setup() enables using of other ...
Mirda Anonym's user avatar
1 vote

DigiSpark AT Tiny85 compile problem?

Another simple option - rewrite or remove the ISR in wiring.c: ...\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\cores\tiny\wiring.c For example after changing like this was able to ...
Jan's user avatar
  • 113
1 vote
Accepted

DigiSpark AT Tiny85 compile problem?

The problem is the following: The digispark core already implements the TIMER1_OVF_vect ISR (Timer1 Overflow Interrupt). Since you have a 1 for the #define TIMER_TO_USE_FOR_MILLIS, Timer1 will be ...
chrisl's user avatar
  • 16.3k

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