avr

how to write code for transfer data from internal memory via SPI Master to 2 slave

不羁岁月 提交于 2019-12-12 04:06:55
问题 I receive data from USB to the internal memory of Atxmega 128A1 if ( (SWITCHPORTL.IN & PIN1_bm) == 0 ) { j = 0; while (j < NUM_BYTES) { // Wait till there is unread data in the receive buffer while((USART.STATUS & USART_RXCIF_bm) == 0 ){}; // Read out the received data __far_mem_write(j+SDRAM_ADDR, USART.DATA); if (j == (NUM_BYTES-1)) { // Toggle LED 1 LEDPORT.OUTTGL = PIN1_bm; } j++; } } How to write code for transfer data from internal memory via SPI Master to two slaves such that odd and

Build AVR Studio 4 project in AVR Studio 5

回眸只為那壹抹淺笑 提交于 2019-12-12 02:12:43
问题 I have an AT90USB162 Minimus AVR which I want to integrate into a project. I downloaded the demo code from Minimus USB. This is a driver for using the AVR as a COM port. The project is written for AVR Studio 4, and cannot be loaded as-is in AVR Studio 5. How can I convert the project for use with AVR Studio 5? 回答1: Well, I just got to build the package. The problem is that the original sources were configured to be built in AVR Studio v.4, and mine is v.5, so I had to convert them to my

avr sleep mode and wake up

天大地大妈咪最大 提交于 2019-12-11 18:07:33
问题 I'm trying to put my AtTiny 13 to sleep and wake it up with interrupt. It does go to sleep but it never wakes up. The whole code: #include <avr/io.h> #include <avr/interrupt.h> #include <stdbool.h> #include <avr/sleep.h> #define RED (1<<PB4) #define RED_HIGH PORTB |=RED #define RED_LOW PORTB &= ~RED #define RED_TOG PORTB ^= RED #define BUTTON 1<<PB1 volatile static bool is_sleeping; ISR(INT0_vect) { RED_TOG; is_sleeping = true; } int main(void){ GIMSK |= 1<<INT0; MCUCR |= 0<<ISC00 | 1<<ISC01;

Very strange gpio behaviour programming ATtiny25v with avr-gcc and avrdude via a raspberry pi

佐手、 提交于 2019-12-11 16:18:49
问题 I have an ATtiny25v connected to a raspberry pi thtough SPI. I use avr-gcc to compile my code. Then I use avrdude to upload it. But I encounter a very strange phenomena : the main function is not called, and instead, the first instructions of the first function have effects on gpio... I have a led connected on portb4. ...I tried with several chip of the same model, and they all behave the same (excluding a buggy one) ...Can someone explain it ? NOTE : I omitted to detail it, but neither the

Multiple definitions of - GCC bogus error

走远了吗. 提交于 2019-12-11 11:26:22
问题 I have a header file lcd.h with this (shortened): #pragma once // ... const uint8_t LCD_ROW_ADDR[] = {0x00, 0x40, 0x14, 0x54}; // ... other prototypes and macros... And a file lcd.c where this variable is used: #include <stdbool.h> #include <stdint.h> // ... #include "lcd.h" // ... /** Set cursor position */ void lcd_xy(const uint8_t x, const uint8_t y) { lcd_set_addr(LCD_ROW_ADDR[y] + (x)); } I include lcd.h in main.c , and lcd.c is compiled separately using makefile. I'm getting this error:

Encountering “Launch failed as no binaries could be found”

可紊 提交于 2019-12-11 10:30:06
问题 In AVR32 Studio (2.6) I'm trying to debug an AVR project and I get the error message "Launch failed as no binaries could be found". I can see in the console that Build is complete (an executable .elf file is in the build folder) and I've cleaned my project, created a new build configuration and I still can't seem to launch (and or program the chip) the debugger. 回答1: Check your debug launch configuration . It ought to be a little more intuitive, but is not. After you create and build your

Avrstudio 4.19 toolchain using gcc 4.7.x

纵饮孤独 提交于 2019-12-11 10:27:16
问题 I'm using makefile style compiling of my ATMEGA projects. As legacy of Arduino IDE, develepment toolchain is mostly aimed to gcc 4.3.2. Avrstudio 4.19 + Jtagice MKII CN + gcc 4.3.2 + make works somehow. But my problem is that gcc 4.3.2 is rather buggy. I see e.g. random bugs related to optimization of non-volatile variables, register cached values are not always written back to memory and also wrong warning are annoying. Hence using gcc 4.7.0 solves problem but I cannot load any such a

keypad don't work correctly in bascom avr program and proteus

孤人 提交于 2019-12-11 08:47:16
问题 I have designed a calculator through bascome avr and proteus, but some numbers in keypad dont work correctly. just 1 , 4 and 7 work nice. 2 and 3 show 1, 5 and 6 show 4, 8 and 9 show 7! where is the problem? My bascom code: $regfile = "M32DEF.DAT" $crystal = 8000000 Config Kbd = Portd Config Lcdpin = Pin , Db4 = Pinb.4 , Db5 = Pinb.5 , Db6 = Pinb.6 , Db7 = _ Pinb.7 , Rs = Pinb.2 , E = Pinb.3 Config Lcd = 20 * 2 Dim A As Single Dim B As Single Dim S As Byte Dim Yab As Single Dim X As Byte Dim

Weird exception thrown when using simulavr with avr-gdb

為{幸葍}努か 提交于 2019-12-11 08:36:52
问题 I am debugging a program that I have written for the AVR architecture and compiled using avr-gcc with the -g argument. I launch simulavr using the following command: simulavr --device atmega8 --gdbserver Then I invoke avr-gdb and do (gdb) file main.elf as well as (gdb) target remote localhost:1212 Once debugging has started, I can successfully step through the assembly portion of my program .init et al. However, once jmp main is executed and a call to another function is made, simulavr throws

Receive a String

情到浓时终转凉″ 提交于 2019-12-11 08:08:53
问题 How to received string in uart. I am using avr studio 5 and brays terminal like this one Same as this picture I am using baudrate of 9600. Went I try to type "abcdef" , it only come out "abcf" . My code are like this ---> #include <avr/io.h> void serial_init(void) { UBRRH = 0x00; UBRRL = 95; //baudrate 9600 and F_CPU 14745600UL UCSRB = (1 << RXEN) | (1 << TXEN) | (1<<RXCIE); UCSRC = (1<<URSEL)|(1<<USBS)|(3<<UCSZ0)|(1 << UCSZ1); } unsigned long long Usart_Receive(void) { while((UCSRA & (1 <<