mcudude / majorcore Goto Github PK
View Code? Open in Web Editor NEWAn Arduino hardware package for ATmega8515 and ATmega162
License: GNU Lesser General Public License v2.1
An Arduino hardware package for ATmega8515 and ATmega162
License: GNU Lesser General Public License v2.1
I just walk through the datasheet. There is no I2C for this MCU, or I am wrong?
And an additional question, by using your package support, can I burn the bootloader and use it just like any other ATmega MCU, say 328p?
I'm trying to utilize Timer1 On an ATmega8515L to generate compare match interrupts. I'm trying to use the OCR1A register to write the desired value for the compare match and OCR1A register is a 16-bit one. Whenever I try to write there a value that is larger than 8bits it just rolls over. When sending back to the computer the value of the OCR1A register via serial, I get only 8 bits and the timing of the interrupt hasn't increased.
Also it seems to me that writing to the OCR1AL and OCR1AH register is impossible, since both return 0 when read. Also writing directly to these doesn't increase the timing according to what I have calculated.
I have this in the setup()
function:
cli(); //disabling interrupts
TCNT1 = 0; //zeroing timer1
OCR1A = 255; //setting the value for the compare match
// page 121 on the datasheet
TCCR1B |= (0 << WGM13); //setting timer mode to clear timer on compare match register B
TCCR1B |= (1 << WGM12); // -||-
TCCR1A |= (0 << WGM11); //setting timer mode to clear timer on compare match register A
TCCR1A |= (0 << WGM10); // -||-
//setting prescaler to 1024, page 122 on the datasheet
TCCR1B |= (1 << CS12);
TCCR1B ^= (1 << CS11);
TCCR1B |= (1 << CS10);
TIMSK |= (1 << OCIE1A); //setting Timer/counter interrupt mask register - enabling interrupts. Page 124 on the datasheet
sei(); //enabling interrupts
Then I have the interrupt function declared like this:
ISR(TIMER1_COMPA_vect){ //TIMER1A_COMPA_vect seems to also be a possible parameter here, but the code was not ran when running the program.
// things to do
}
I also have a few additional curious observations. Writing 1 to OCIE1B on the TIMSK register seems to break delay()
. This function should be using only timer0 right?
Also the other CTC mode on the datasheet (mode 12, on page 121) Seems to always generate interrupt at the longest possible interval no matter what I set the ICR1 register to. The prescaler settings affect this as they should.
Thanks!
Eemil
Hi,
Thank you for such a library.
I am using Arduino ide v2.3.2.
I detected a problem on Atmega162 in Major core 2.1.3 and above.
And also Including 3.0.1, this problem exists.
When I use Atmega162 with Pin31 (PE0 INT2) interrupt, the program is reset and restarts from the beginning.
This problem does not exist in Major Core 2.1.2.
Best Regards.
I'm trying to use interrupts on atmega8515
i'm trying to decode a quadrature decoder using two input pins with interrupts.
The funcion"decodeEndoder()" works on attiny85.
It is the correct way to attach interrupts?
It seems that digitalread inside ISR routine doesn't give us the right value.
This is our code. Do you have any example of using interrupts whit your library?
#include "avr/interrupt.h";
volatile int lastEncoded = 0;
volatile int direction = 0; // 1 = senso orario 0 = senso antiorario
volatile int clock = 0; //manda un incremento come fronte di salita
const int encPinA = 10;
const int encPinB = 11;
const int outPinClock = 8;
const int outPinDir = 9;
unsigned char enc_dir;
unsigned char enc_last=0;
unsigned char enc_now;
void setup()
{
pinMode(encPinA, INPUT);
pinMode(encPinB, INPUT);
digitalWrite(encPinA, HIGH);
digitalWrite(encPinB,HIGH);
pinMode(outPinClock, OUTPUT);
pinMode(outPinDir, OUTPUT);
attachInterrupt(digitalPinToInterrupt(encPinA),decodeEncoder,CHANGE);
attachInterrupt(digitalPinToInterrupt(encPinB),decodeEncoder,CHANGE);
}
void loop()
{
}
// This is the ISR that is called on each interrupt
// Taken from http://bildr.org/2012/08/rotary-encoder-arduino/
void decodeEncoder()
{
int MSB = digitalRead(encPinA); //MSB = most significant bit
int LSB = digitalRead(encPinB); //LSB = least significant bit
int encoded = (MSB << 1) |LSB; //converting the 2 pin value to single number
int sum = (lastEncoded << 2) | encoded; //adding it to the previous encoded value
if(sum == 0b1101 || sum == 0b0100 || sum == 0b0010 || sum == 0b1011)
{
digitalWrite(outPinDir,HIGH);
digitalWrite(outPinClock, HIGH);
digitalWrite(outPinClock, LOW);
}
if(sum == 0b1110 || sum == 0b0111 || sum == 0b0001 || sum == 0b1000)
{
digitalWrite(outPinDir,LOW);
digitalWrite(outPinClock, HIGH);
digitalWrite(outPinClock, LOW);
}
lastEncoded = encoded; //store this value for next time
}
I need to create a custom bootloader for mega1284P with 14.746MHz , baudrate=57600
and LED on port C7.
I am using the C:\arduino183\hardware\MightyCore\avr\bootloaders\optiboot.old database.
changed the OMAKE.bat path to C:\WinAVR-20100110\utils\bin\make OS=windows ENV=arduino %*
and compiling the new entry.
I get error messages :
Optiboot ..undefined reference to 'eeprom_write_byte'
Optiboot ..undefined reference to 'eeprom_read_byte'
see attached :
in optiboot.c the code shows
/*
it looks like the BIGBOOT parameter is used only in this eeprom section.
I am NOt using the EEPROM ... so what is the solution ?
I was thinking of just changing the code to :
switch (memtype) {
case 'E': // EEPROM
#if defined(SUPPORT_EEPROM)
while(len--) {
eeprom_write_byte((uint8_t *)(address++), *mybuff++);
}
#else
basically removing the BIGBOOT parameter.
please advise if this is OK ... and also what is the syntax for NOT using EEPROM
if using the optiboot_flash code ?
Link to screen shots and source code is located at :
https://drive.google.com/open?id=0B8APtZDn4cUtS3RXYm1rUUtnc1U
thanks
[email protected]
Hi again :)
I finally decided, that I will buy this very nice board:
"https://www.tindie.com/products/MCUdude/dip-40-arduino-compatible-development-board/"
But as I am total-amateur, I need some answers again.
May I please You?
Is that possible to buy from you beside this board also microcontrollers: 1x ATmega1284, 1x ATmega644, 1x ATmega324, 1x ATmega164, 1x ATmega32, 1x ATmega16, 1x ATmega8535 ?
If I will want to program these microcontrollers, I suppose to do:
a) I will install on PC into Arduino IDE package "https://github.com/MCUdude/MightyCore"
b) I will insert new microcontroller into this your nice board
c) instead of Arduino Uno board I will connect only your board to PC-USB
d) I will choose from menu corresponding menu-items for inserted microcontroller
e) than I Burn bootloader
f) and Sketch
Is this correct?
I am asking for this, because last time You wrote me:
"I will, however, recommend you to buy a dedicated programmer."
But I do not want to use another programmer - I would like to use Arduino IDE.
Next You wrote:
"Note that this board has a USB to serial adapter, so you will only need a programmer if you want to change some of the settings such as internal/external clock..."
So - if I will NOT want to change some of the settings, all is OK with point [2] ?
If I understand, there are 2 ways how to program these microcontrollers.
a) either I put them on breadboard, I use Arduino UNO board and I Program it as ISP (with your library).
b) or I put them on your board and I use direct programming (with you library) --> so not ISP.
Is this correct?
I would like to buy from You also 1x ATmega8515 and 1x ATmega162.
You wrote:
"With this board you can't program ATmega8515 and ATmega162, because these have a different pinout. However, I do have an adapter I can add if for free if you like so that you can use ATmega8515 and ATmega162 with it."
So I only insert one of these 2 microcontrollers into your adapter,
this adapter I will insert into your nice board,
this board I will connect to PC,
I will run Arduino IDE,
I will choose library "https://github.com/MCUdude/MajorCore" and corresponding chip,
and I will burn Bootloader and than load Sketch.
Is this process right?
If all is like I suppose, could You please send me total price?
I summarize all for buying:
1x https://www.tindie.com/products/MCUdude/dip-40-arduino-compatible-development-board/
1x ATmega1284
1x ATmega644
1x ATmega324
1x ATmega164
1x ATmega32
1x ATmega16
1x ATmega8535
1x ATmega8515
1x ATmega162
Thank you very much for answers
Zdenda
hi
maybe i do understand this bootloader logic wrong
i have flashed bootloader to my atmega162 with SPI.
FUSES are: H: 0xD2 L: 0xFF E: 0xFF, LOCK 0xFF
connected chip over RX+TX and arduino has flashed my code blink code at PE0 PIN with success
but second time to flash it no more work
is this a bug?
do arduino overwrite the bootloader with my blink code?
do i flashed bootloader wrong? (did try over arduino and atmel studio, had success to burn it, but can only flash chip 1 time over UART)
The core is almost finished, and I think it's ready for its first release. I'm not sure if I'm going to to create an Arduino port about this core, but I'm adding it to the "Arduino on other Atmel chips" page. Would you like to help @per1234 ? 👍
Hi, I'm new to bootloading. I followed the instructions with the circuit provided in the details. After running ArduinoISP on ArduinoUno and bootloading to ATMEGA8515L
at first I got a message stating that my device was recognized as Device Signature: 0x1e9301
whereas in the config the signature for the microcontroller was set to 0x1e9306
which led the bootloader to stop. I ran the bootloader a couple of times and after a few restarts of Arduino IDE and my PC, the device signature always shows as 0x00000000
. Please see the log below:
avrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "C:\Users\username\AppData\Local\Arduino15\packages\MajorCore\hardware\avr\1.0.1/avrdude.conf"
Using Port : COM9
Using Programmer : stk500v1
Overriding Baud Rate : 19200
AVR Part : ATmega8515
Chip Erase delay : 9000 us
PAGEL : P00
BS2 : P00
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 4 20 128 0 no 512 0 0 9000 9000 0xff 0xff
flash 33 6 64 0 yes 8192 64 128 4500 4500 0xff 0xff
lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
efuse 0 0 0 0 no 0 0 0 0 0 0x00 0x00
lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
calibration 0 0 0 0 no 4 0 0 0 0 0x00 0x00
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
Programmer Type : STK500
Description : Atmel STK500 Version 1.x firmware
Hardware Version: 2
Firmware Version: 1.18
Topcard : Unknown
Vtarget : 0.0 V
Varef : 0.0 V
Oscillator : Off
SCK period : 0.1 us
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.02s
avrdude: Device signature = 0x000000 (retrying)
Reading | ################################################## | 100% 0.02s
avrdude: Device signature = 0x000000 (retrying)
Error while burning bootloader.
Reading | ################################################## | 100% 0.02s
avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
this check.
avrdude done. Thank you.
Your help will be appreciated. Thanks
I don't know what is wrong. It says that device signature is probably 8515 but then error says it should be different. I tried on multiple 8515 chips and always same error. I tried changing different crystals. It worked when I uploaded bin file from MajorCore/avr/libraries/AVR_examples/examples/Blink via AVRDUDESS. This error comes if I want to erase bootloader or upload using programmer in Arduino.
Wiring is same as minimal setup, I just added 10uF cap betwen rst and gnd.
avrdude: Version 7.1-arduino.1
Copyright the AVRDUDE authors;
see https://github.com/avrdudes/avrdude/blob/main/AUTHORS
System wide configuration file is C:\Users\Username\AppData\Local\Arduino15\packages\MajorCore\hardware\avr\2.2.1\avrdude.conf
Using Port : usb
Using Programmer : usbasp
Setting bit clk period : 32.0
AVR Part : ATmega8515
Chip Erase delay : 9000 us
RESET disposition : dedicated
RETRY pulse : SCK
Serial program mode : yes
Parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page Polled
Memory Type Alias Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 4 20 128 0 no 512 1 0 9000 9000 0xff 0xff
flash 33 6 64 0 yes 8192 64 128 4500 4500 0xff 0xff
lfuse 0 0 0 0 no 1 1 0 4500 4500 0x00 0x00
hfuse 0 0 0 0 no 1 1 0 4500 4500 0x00 0x00
lock 0 0 0 0 no 1 1 0 4500 4500 0x00 0x00
signature 0 0 0 0 no 3 1 0 0 0 0x00 0x00
calibration 0 0 0 0 no 4 1 0 0 0 0x00 0x00
Programmer Type : usbasp
Description : USBasp, http://www.fischl.de/usbasp/
avrdude: set SCK frequency to 16000 Hz
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e9301 (probably 8515)
avrdude main() error: expected signature for ATmega8515 is 1E 93 06
double check chip or use -F to override this check
avrdude done. Thank you.
Failed chip erase: uploading error: exit status 1
I chose the title 8051core as a working title, because the ATmega8515 and ATmega162 is pin compatible with the old 8051's. I don't feel like merging this into MightyCore, since these chips don't got the same pinout and peripherals. No ADC and i2c for instance.
If it's possible, I want to make the core start with the letter 'M', like all the other cores, but a suited name is more important than the first letter.
A little background info:
Does "core master" @SpenceKonde or "boards manager master" @per1234 have any great names they want to share? 😉
Hi,
is there a way to add external ram support to MajorCore?
I have a few cheap VCDS clones with atmega162 mcu and ft232rl
uploading via USBasp works, upload via serial does not work
reset via usb works
Hi friend again !
May I pleas you for help?
I am trying to load scatch to ATmega328P with 8MHz internal oscillator.
This is normally working chip witch scatch, but I used it with 16MHz external oscillator.
I put this chip into Arduino Uno board,
I set
https://mcudude.github.io/MiniCore/package_MCUdude_MiniCore_index.json
in Arduino IDE, installed it, set in menu:
Hi,
may I have some questions, please?
If I buy this:
https://www.tme.eu/cz/details/atmega2560-16au/rodina-avr-8-bitu/microchip-atmel/
and this:
https://www.waveshare.com/stm32-qfp100.htm
will I be able to use your MegaCore library to program (and burn bootloader) this microcontroller in this adapter ?
is this microcontroller compatible with this adapter? (I am amateur and I do not know, if TQFP100 and QFP100 are compatible)
what programmer (PCB) will I need? May I use the same, what I use for programming your PCB:
https://www.tindie.com/products/MCUdude/dip-40-arduino-compatible-development-board/
which I bought ?
Thay have on web only photo with some programmer without description.
Thank you very much
Zdenda
Hi!
Is it possible to have a support for ATMega4808? I tried to understand what is done here, but I am too noob to edit these files. I can use ATMega1284, but it is quite large physically. 4808 is quite small with nice amount of SRAM.
Thanks.
hi
i have flashed the bootloader from compiled file: bootloader_optiboot_flash_atmega162_UART0_115200_7372800L_B0.hex
now i did a new version of the bootloader with changed LED PIN to E0
Is it posible to overwrite the current bootloader over UART0 with the new bootloader?
Hello,
the instructions for installing MajorCore with Boards manager give this URL to paste into the Preferences dialog:
https://mcudude.github.io/MiniCore/package_MCUdude_MiniCore_index.json
That didn't seem to add the MajorCore package to boards manager, so I edited it to look like this:
https://mcudude.github.io/MajorCore/package_MCUdude_MajorCore_index.json
And that made MajorCore visible.
(BTW thank you so much for these. I have many old AVRs getting new life from them!)
I tried to burn bootlader of atmega162 using your library and arduino as ISP with Arduino IDE 1.6.5.
I receive the following error.
avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
this check.
I tried with internal or external oscillator.
I programmed successfully with the same method and wiring an atmega8515.
I managed to load bootlader and sketch.
With the atmega162, neither of the two programming worked.
I tried with different chips of the same type, but the beahavior is the same.
Could you help me, please?
There's a 100% chance I'm missing something, but the steps for using PC interrupts on arduino projects cannot be applied using majorcore because "'PCICR' was not declared in this scope"
Hello,
i would like to ask you for help, because nowhere on the web i found the answer.
I already wrote asking on:
https://forum.arduino.cc/index.php?topic=561320.0
but nobody helped me.
Problem is not solved and now I would like to use ATmega8515L to my project.
I can describe here all:
In menu „File\Preferences\Additional boards manager URLs" i put new link:
https://mcudude.github.io/MajorCore/package_MCUdude_MajorCore_index.json
In menu „Tools\Board\Boards manager" i scrolled to „MajorCore by MCUdude" and choosed „install"
In menu „Tools\Board" then i see: „MajorCore/ATmega8515". Good.
Into Arduino UNO i loaded „File\Examples\ArduinoISP\ArduinoISP", and then i unplugged PC.
I connected ATmega8515L on breadboard:
UNO (5V) ---> ATMega8515L (pin 40 - 5V)
UNO (GND) ---> ATMega8515L (pin 20 - GND)
UNO (pin10) ---> ATMega8515L (pin 9 - reset)
UNO (pin11) ---> ATMega8515L (pin 6 - MOSI)
UNO (pin12) ---> ATMega8515L (pin 7 - MISO)
UNO (pin13) ---> ATMega8515L (pin 8 - SCK)
On ATMega8515L pins 18 (XTAL2) and 19 (XTAL1) i connected crystal 16 Mhz and capacitors 22 pF to GND.
And on Arduino UNO i used electrolyt. capacitor 10 mikrofarads between RESET-GND (minus to GND).
then i connect PC.
I choose in menu:
„Tools\Board\ATmega8515"
„Tools\BOD\2.7v"
„Tools\Clock\16MHz external"
„Tools\Compiler LTO: Disabled (default)"
„Tools\Programator\Arduino as ISP"
and i tryied: „Tools\Burn bootloader"
Arduino: 1.8.3 (Windows 10), Vývojová deska: "ATmega8515, 2.7v, Disabled (default), 16 MHz external"
C:\Arduino\hardware\tools\avr/bin/avrdude -CC:\Users\zdenek.zubr\AppData\Local\Arduino15\packages\MajorCore\hardware\avr\1.0.1/avrdude.conf -v -patmega8515 -cstk500v1 -PCOM8 -b19200 -e -Ulock:w:0x3f:m -Uefuse:w:{bootloader.extended_fuses}:m -Uhfuse:w:0xd4:m -Ulfuse:w:0b10111111:m
avrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "C:\Users\zdenek.zubr\AppData\Local\Arduino15\packages\MajorCore\hardware\avr\1.0.1/avrdude.conf"
Using Port : COM8
Using Programmer : stk500v1
Overriding Baud Rate : 19200
AVR Part : ATmega8515
Chip Erase delay : 9000 us
PAGEL : P00
BS2 : P00
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 4 20 128 0 no 512 0 0 9000 9000 0xff 0xff
flash 33 6 64 0 yes 8192 64 128 4500 4500 0xff 0xff
lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
efuse 0 0 0 0 no 0 0 0 0 0 0x00 0x00
lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
calibration 0 0 0 0 no 4 0 0 0 0 0x00 0x00
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
Programmer Type : STK500
Description : Atmel STK500 Version 1.x firmware
Hardware Version: 2
Firmware Version: 1.18
Topcard : Unknown
Vtarget : 0.0 V
Varef : 0.0 V
Oscillator : Off
SCK period : 0.1 us
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.02s
avrdude: Device signature = 0x000000 (retrying)
Reading | ################################################## | 100% 0.02s
avrdude: Device signature = 0x000000 (retrying)
Chyba při vypalování zavaděče.
Reading | ################################################## | 100% 0.02s
avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
this check.
avrdude done. Thank you.
================================================================
I tryied use 5V / 3.3V from Arduino - unfortunatelly - same result.
I tryied use variations of BOD, Compiler LTO, 8 MHz internal crystal - unfortunatelly - same result.
I tryied put between RESET of chip and 5V rezistor - unfortunatelly - same result.
I normally programm ATTiny85 and ATmega328p on breadboard via Arduino ISP (only with different core) - all is ok, all chips are normally programmed (including burning bootloaders).
THANK YOU VERY MUCH FOR ANY IDEA.
Zdenda from Czech Republic
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.