Giter Club home page Giter Club logo

majorcore's Introduction

MajorCore

Build Status

An Arduino core for large, 8051 pin compatible, breadboard friendly AVRs, all running the Urboot bootloader. This core requires at least Arduino IDE v1.8, where v1.8.9 or newer is recommended. IDE 2.x should also work.

From MajorCore version 3 and onwards, the Optiboot bootloader has been replaced by the superior Urboot bootloader. It's smaller, faster, and has automatic baud rate detection, and can read and write to EEPROM. Other cool features the bootloader provides but are not utilized by MajorCore are user program metadata stored in flash (that can easily be viewed by Avrdude -xshowall) and chip-erase functionality. If you already have Optiboot installed and don't want to replace it with Urboot, you can still upload programs without any compatibility issues. However, if you're burning a bootloader to a new chip, Urboot is the way to go.

Table of contents

Supported microcontrollers

  • ATmega162
  • ATmega8515

Supported clock frequencies

MajorCore supports a variety of different clock frequencies. Select the microcontroller in the boards menu, then select the clock frequency. You will have to hit "Burn bootloader" in order to set the correct fuses and upload the correct bootloader. This also has to be done if you want to change any of the fuse settings (BOD and EEPROM settings) regardless if a bootloader is installed or not.

Make sure you connect an ISP programmer, and select the correct one in the "Programmers" menu. For time-critical operations, an external crystal/oscillator is recommended. The Urboot bootloader has automatic baud rate detection, so UART uploads should work fine even though the oscillator is a little too fast or too slow.

Frequency Oscillator type Default upload speed
(bootloader has auto-baud)
Comment
16 MHz External crystal/oscillator 115200 Default clock on most AVR based Arduino boards
20 MHz External crystal/oscillator 115200
18.4320 MHz External crystal/oscillator 115200 Great clock for UART communication with no error
14.7456 MHz  External crystal/oscillator 115200 Great clock for UART communication with no error
12 MHz External crystal/oscillator 57600
11.0592 MHz External crystal/oscillator 115200 Great clock for UART communication with no error
9.216 MHz External crystal/oscillator 115200 Great clock for UART communication with no error
8 MHz External crystal/oscillator 57600 Common clock when working with 3.3V
7.3728 MHz External crystal/oscillator 115200 Great clock for UART communication with no error
6 MHz External crystal/oscillator 57600
4 MHz External crystal/oscillator 9600
3.6864 MHz External crystal/oscillator 115200 Great clock for UART communication with no error
2 MHz External crystal/oscillator 9600
1.8432 MHz External crystal/oscillator 115200 Great clock for UART communication with no error
1 MHz External crystal/oscillator 9600
8 MHz Internal oscillator 38400 Might cause UART upload issues. See comment above
4 MHz Internal oscillator 9600 Derived from the 8 MHz internal oscillator
2 MHz Internal oscillator 9600 Derived from the 8 MHz internal oscillator
1 MHz Internal oscillator 9600 Derived from the 8 MHz internal oscillator

Bootloader option

MajorCore lets you select which serial port you want to use for uploading. UART0 is the default port for all targets, but ATmega162 can also use UART1 for upload. If your application doesn't need or require a bootloader for uploading you can also choose to disable it by selecting No bootloader. This frees 384 bytes of flash memory on ATmega8/88/168/328 and 320 bytes on the ATmega48.

Note that you need to connect a programmer and hit Burn bootloader if you want to change any of the Bootloader settings.

Baud rate option

Since Urboot has automatic baud rate detection, the upload baud rate can be changed without having to re-flash the bootloader. The default baud rate setting will pick a suited baud rate that also works with the legacy Optiboot bootloader used in earlier MajorCore versions. The other baud rate options may or may not work, depending on the clock frequency and accuracy of the clock source. A rule of thumb is that "non-round" baud rates like 230400 works best with "non-round" clock speeds like 18.4320 MHz, while "round" ones like 16 MHz work best with "round" baud rates like 250000.

BOD option

Brown-out detection, or BOD for short lets the microcontroller sense the input voltage and shut down if the voltage goes below the brown-out setting. To change the BOD settings you'll have to connect an ISP programmer and hit "Burn bootloader". Below is a table that shows the available BOD options:

ATmega162 ATmega8515
4.3V 4.0V
2.7V 2.7V
1.8V -
Disabled Disabled

EEPROM option

If you want the EEPROM to be erased every time you burn the bootloader or upload using a programmer, you can turn off this option. You'll have to connect an ISP programmer and hit "Burn bootloader" to enable or disable EEPROM retain. Note that when uploading using a bootloader, the EEPROM will always be retained.

Note that if you're using an ISP programmer or have the Urboot bootloader installed, data specified in the user program using the EEMEM attribute will be uploaded to EEPROM when you upload your program in Arduino IDE. This feature is not available when using the older Optiboot bootloader.

#include <avr/eeprom.h>

volatile const char ee_data EEMEM = {"Data that's loaded straight into EEPROM\n"};

void setup() {
}

void loop() {
}

Link time optimization / LTO

Link time optimization (LTO for short) optimizes the code at link time, usually making the code significantly smaller without affecting performance. You don't need to hit "Burn Bootloader" in order to enable or disable LTO. Simply choose your preferred option in the "Tools" menu, and your code is ready for compilation. If you want to read more about LTO and GCC flags in general, head over to the GNU GCC website!

Printf support

Unlike the official Arduino cores, MajorCore has printf support out of the box. If you're not familiar with printf you should probably read this first. It's added to the Print class and will work with all libraries that inherit Print. Printf is a standard C function that lets you format text much easier than using Arduino's built-in print and println. Note that this implementation of printf will NOT print floats or doubles. This is disabled by default to save space but can be enabled using a build flag if using PlatformIO.

If you're using a serial port, simply use Serial.printf("Milliseconds since start: %ld\n", millis());. You can also use the F() macro if you need to store the string in flash. Other libraries that inherit the Print class (and thus supports printf) are the LiquidCrystal LCD library and the U8G2 graphical LCD library.

Pin macros

Note that you don't have to use the digital pin numbers to refer to the pins. You can also use some predefined macros that map "Arduino pins" to the port and port number:

// Use PIN_PB0 macro to refer to pin PB0 (Arduino pin 0)
digitalWrite(PIN_PB0, HIGH);

// Results in the exact same compiled code
digitalWrite(0, HIGH);

Write to own flash

MajorCore uses the excellent Urboot bootloader, written by Stefan Rueger. Urboot supports flash writing within the running application, meaning that content from e.g. a sensor can be stored in the flash memory directly without needing external memory. Flash memory is much faster than EEPROM, and can handle at least 10,000 write cycles before wear becomes an issue. For more information on how it works and how you can use this in your own application, check out the Serial_read_write for a simple proof-of-concept demo, and Flash_put_get + Flash_iterate for useful examples on how you can store strings, structs, and variables to flash and retrieve then afterward.

How to install

Boards Manager Installation

This installation method requires Arduino IDE version 1.8.0 or greater.

  • Open the Arduino IDE.

  • Open the File > Preferences menu item.

  • Enter the following URL in Additional Boards Manager URLs:

    https://mcudude.github.io/MajorCore/package_MCUdude_MajorCore_index.json
    
  • Open the Tools > Board > Boards Manager... menu item.

  • Wait for the platform indexes to finish downloading.

  • Scroll down until you see the MajorCore entry and click on it.

  • Click Install.

  • After installation is complete close the Boards Manager window.

Manual Installation

Click on the "Download ZIP" button. Extract the ZIP file, and move the extracted folder to the location "~/Documents/Arduino/hardware". Create the "hardware" folder if it doesn't exist. Open Arduino IDE, and a new category in the boards menu called "MajorCore" will show up.

Arduino CLI Installation

Run the following command in a terminal:

arduino-cli core install MajorCore:avr --additional-urls https://mcudude.github.io/MajorCore/package_MCUdude_MajorCore_index.json

PlatformIO

PlatformIO is an open-source ecosystem for IoT and embedded systems, and supports MajorCore.

See PlatformIO.md for more information.

Getting started with MajorCore

  • Hook up your microcontroller as shown in the pinout diagram.
    • If you're not planning to use the bootloader (uploading code using a USB to serial adapter), the FTDI header and the 100 nF capacitor on the reset pin can be omitted.
  • Open the Tools > Board menu item, select MajorCore and select your preferred target.
  • You can select at what voltage the microcontroller will shut down by changing the BOD setting. Read more about BOD here.
  • Select your preferred clock frequency. 16 MHz is standard on most Arduino boards.
  • Select what kind of programmer you're using under the Programmers menu.
  • Hit Burn Bootloader. The LED pin will not toggle after the bootloader has been loaded.
  • Disconnect the ISP programmer, and connect a USB to serial adapter to the target microcontroller shown in the pinout diagram. Select the correct serial port under the Tools menu, and click the Upload button. If you're getting a timeout error, it may be because the RX and TX pins are swapped, or the auto-reset circuit isn't working properly (the 100 nF capacitor and a 10k resistor on the reset line).

Your code should now be running on your microcontroller!

Wiring reference

To extend this core's functionality a bit further, I've added a few missing Wiring functions. As many of you know Arduino is based on Wiring, but that doesn't mean the Wiring development isn't active. These functions are used as "regular" Arduino functions, and there's no need to include an external library.
I hope you find this useful because they really are!

Function list

  • portMode()
  • portRead()
  • portWrite()
  • sleepMode()
  • sleep()
  • noSleep()
  • enablePower()
  • disablePower()

For further information please view the Wiring reference page!

MajorCore development board

If you want to play around with this Arduino core and you don't have any hardware, you can use a development board instead of wiring up the microcontroller on a breadboard. There are many development boards available, both cheap and expensive ones. If you're interested, you should have a look at the MajorCore development guide; where you can find some detailed information. Link down below!

Pinout

MajorCore provides a standard, logical pinout for ATmega8515 and ATmega162. The standard LED pin is assigned to digital pin 0/PIN_PB0. Click to enlarge:

Minimal setup

Here is a simple schematic showing a minimal setup using an external crystal. Skip the crystal and the two capacitors if you're using the internal oscillator.

majorcore's People

Contributors

mcudude avatar per1234 avatar sconaway avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

majorcore's Issues

External RAM

Hi,
is there a way to add external ram support to MajorCore?

Programming ATmega328P put in Arduino Uno board - but with 8MHz internal oscillator

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:

  • ATmega328
  • Internal 8MHz (but I tryied 4MHz, 2Mhz and 1MHz too)
  • BOD 2.7V
  • EEPROM retained
  • LTO disabled
  • 328P / 328PA
  • Yes (UART0) (but I tryied No bootloader too)
  • COM3 (Arduino Uno)
    And as Programmer I tryied all "xxxxx (MiniCore)" items, one by one.
    But I am not able to load scatch :(
    Can you help me please?
    Zdenda

ATmega8515 interrupt routine

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

}

problem with Atmega162

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.

Optiboot ..undefined reference to 'eeprom_write_byte'

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
/*

  • void writebuffer(memtype, buffer, address, length)
    */
    static inline void writebuffer(int8_t memtype, uint8_t *mybuff,
    uint16_t address, pagelen_t len)
    {
    switch (memtype) {
    case 'E': // EEPROM
    #if defined(SUPPORT_EEPROM) || defined (BIGBOOT)
    while(len--) {
    eeprom_write_byte((uint8_t *)(address++), mybuff++);
    }
    #else
    /
    • On systems where EEPROM write is not supported, just busy-loop
    • until the WDT expires, which will eventually cause an error on
    • host system (which is what it should do.)
      */
      same for the READ_BYTE section.

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]

Please help me - how to load bootloader into chip ATmega8515L

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"

But i get:

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

Wrong signature for 8515

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

MegaCore library and ATmega2560

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

  1. will I be able to use your MegaCore library to program (and burn bootloader) this microcontroller in this adapter ?

  2. is this microcontroller compatible with this adapter? (I am amateur and I do not know, if TQFP100 and QFP100 are compatible)

  3. 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

Pin change interrupts... PCICR?

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"

Cannot write full 16bits to OCR1A register

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

Bootloading ATMEGA8515L

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

Programming with your board "dip-40-arduino-compatible-development-board"

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?

  1. 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 ?

  2. 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?

  3. 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.

  4. 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] ?

  5. 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?

  6. 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?

  7. 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

  • postage money
  1. Do you have some board for programming this (100 pins) microcontroller?
    https://www.microchip.com/wwwproducts/en/ATmega2560
    I suppose that I will use library: "https://github.com/MCUdude/MegaCore".
    But the board should be able to replace chips.

Thank you very much for answers
Zdenda

ATMega4808 support

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.

Seriously, I need a better name for this core!

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:

  • The AT90S8515/ATmega8515 was one of the very first AVR microcontrollers released, and where (almost, except the reset pin) pin compatible with the old 8051.
  • They have been around for a long time, and are considered "mature"
  • The ATmega8515 can still be bought for 1.26$ at Ebay
  • The ATmega8515 was shipped with the STK500 starter kit, so a lot of people are unaware that they (now) own a capable Arduino compatible microcontroller.

Does "core master" @SpenceKonde or "boards manager master" @per1234 have any great names they want to share? 😉

ATmega8515 I2C

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?

bootloader flash

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?

flash bug?

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)

Mistaken Boards Manager URL for MajorCore Install?

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!)

atmega162 problem

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?

Add boards manager support

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 ? 👍

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.