avr

Arduino (Uno) Ethernet client connection fails after many client prints

为君一笑 提交于 2019-12-10 14:22:54
问题 I'm using an Arduino Uno with Ethernet Shield. After sending many HTTP requests, client.println(...) , the client starts to fail when connecting. The time to failure appears to be random, and the sequence readout from the loop can vary anywhere between ~1000 and ~7000. The error is not to do with the Ethernet Transmit Buffer overflowing (Following this advice) Here is the code that is failing: #include <Ethernet.h> #include <SPI.h> // Network constants byte mac[] = {0x00, 0x23, 0xdf, 0x82,

Initializing a variable and specifying the storage address the same time: is it possible?

故事扮演 提交于 2019-12-10 13:59:09
问题 In the codevision compiler for Atmel processors, there is a possibility to specify the storage address of a global variable, for example int a @0x100; // will place the variable at the address 0x100 in RAM Of course, as per standard C, variables can be initialized upon declaration int a=42; However, I did not find any possibility to do them both. int a @0x100 = 42 or int a = 42 @0x100; don't work, they cause compiler errors. You might ask why it is so important to do it, because one could

How to link against just symbols correctly

妖精的绣舞 提交于 2019-12-10 12:09:56
问题 I guess this is a continuation of this question. I've compiled my intermediate bootloader library and have verified it working, now it's time to write some application code against it. I'm able to generate a symbol list from the bootloader's generated .hex file using $(OBJCOPY) --wildcard --strip-symbol=main --strip-symbol="_*" $(TARGET).elf $(TARGET).syms , this gives me bootloader.syms . I've written a test application that uses a few of the functions in the library section of memory, and I

Undefined reference to 'operator delete(void*)'

a 夏天 提交于 2019-12-09 08:21:35
问题 I'm new to C++ programming, but have been working in C and Java for a long time. I'm trying to do an interface-like hierarchy in some serial protocol I'm working on, and keep getting the error: Undefined reference to 'operator delete(void*)' The (simplified) code follows below: PacketWriter.h: class PacketWriter { public: virtual ~PacketWriter() {} virtual uint8_t nextByte() = 0; } StringWriter.h: class StringWriter : public PacketWriter { public: StringWriter(const char* message); virtual

What's the difference/relationship between AVR and Arduino?

好久不见. 提交于 2019-12-09 07:51:52
问题 I've been interested in hardware programming recently, but I have not started yet. I did some searching working, and have a vague idea: Arduino is a combination of both chip and breadboard. AVR is a single chip, and need to buy a breadboard to get started. Is that statement true or false? 回答1: AVR is just an integrated circuit microchip, made by Atmel. It looks something like this: Although they can be used by themselves, it takes a bit of hardware experience and some support components. The

Faster 16bit multiplication algorithm for 8-bit MCU

偶尔善良 提交于 2019-12-09 07:51:35
问题 I'm searching for an algorithm to multiply two integer numbers that is better than the one below. Do you have a good idea about that? (The MCU - AT Tiny 84/85 or similar - where this code runs has no mul/div operator) uint16_t umul16_(uint16_t a, uint16_t b) { uint16_t res=0; while (b) { if ( (b & 1) ) res+=a; b>>=1; a+=a; } return res; } This algorithm, when compiled for AT Tiny 85/84 using the avr-gcc compiler, is almost identical to the algorithm __mulhi3 the avr-gcc generates. avr-gcc

AVRDUDE Android Arduino ioctl error

泄露秘密 提交于 2019-12-09 06:56:19
问题 My previous question, Android cannot talk to Arduino using AVRDUDE , has been resolved. I can now connect my Nexus 7 to my Arduino Uno. The full command I am running is this: /system/xbin/su (getting root here) /data/data/jackpal.androidterm/local/bin/avrdude -F -V -c arduino -p ATMEGA328P -P /dev/bus/usb/002/002 -b 115200 -C /data/data/jackpal.androidterm/local/etc/avrdude.conf -U flash:w:led.hex Here I am trying to put the hex file on the Arduino. I do however get the following error:

Convert Raw 14 bit Two's Complement to Signed 16 bit Integer

为君一笑 提交于 2019-12-08 15:38:39
问题 I am doing some work in embedded C with an accelerometer that returns data as a 14 bit 2's complement number. I am storing this result directly into a uint16_t . Later in my code I am trying to convert this "raw" form of the data into a signed integer to represent / work with in the rest of my code. I am having trouble getting the compiler to understand what I am trying to do. In the following code I'm checking if the 14th bit is set (meaning the number is negative) and then I want to invert

AVR XYZ Registers

ぐ巨炮叔叔 提交于 2019-12-08 10:42:45
问题 What is the difference beatwean X, Y and Z registers in AVR microcontrollers. What for each of them suitable in C compilers? And where do compilers store heap pointer, stack pointer, frame pointer? Do this registers have the same capabilities or providing addressing in different spaces(ex. EEPROM, RAM). 回答1: X Y and Z registers are actually pairs of r27:r26, r29:r28 and r31:r30 registers. Each of them can be used as indirect pointers to SRAM: ld r16, X with post-increment, or pre-decrement:

Can GNU ld be instructed to print which .o files are needed during a link?

て烟熏妆下的殇ゞ 提交于 2019-12-08 09:31:37
问题 A little background: I'm trying to build an AVR binary for an embedded sensor system, and I'm running close to my size limit. I use a few external libraries to help me, but they are rather large when compiled into one object per library. I want to pull these into smaller objects so only the functionality I need is linked into my program. I've already managed to drop the binary size by 2k by splitting up a large library. It would help a lot to know which objects are being used at each stage of