Browse Source

Version 0.85 (20081203)

master
Olaf Rempel 11 years ago
parent
commit
1509afc016
12 changed files with 23 additions and 70 deletions
  1. +17
    -2
      main.c
  2. +0
    -7
      mega128.h
  3. +0
    -6
      mega128can.h
  4. +0
    -7
      mega16.h
  5. +0
    -7
      mega162.h
  6. +0
    -7
      mega169.h
  7. +0
    -7
      mega32.h
  8. +0
    -7
      mega64.h
  9. +0
    -7
      mega644.h
  10. +0
    -7
      mega8.h
  11. +0
    -6
      megaxx4p.h
  12. +6
    -0
      readme.txt

+ 17
- 2
main.c View File

@@ -1,7 +1,7 @@
/*****************************************************************************
*
* AVRPROG compatible boot-loader
* Version : 0.83 (Apr. 2008)
* Version : 0.85 (Dec. 2008)
* Compiler : avr-gcc 4.1.2 / avr-libc 1.4.6
* size : depends on features and startup ( minmal features < 512 words)
* by : Martin Thomas, Kaiserslautern, Germany
@@ -149,6 +149,15 @@
#define GET_EXTENDED_FUSE_BITS 0x0002


#ifdef UART_DOUBLESPEED
// #define UART_CALC_BAUDRATE(baudRate) (((F_CPU*10UL) / ((baudRate) *8UL) +5)/10 -1)
#define UART_CALC_BAUDRATE(baudRate) ((uint32_t)((F_CPU) + ((uint32_t)baudRate * 4UL)) / ((uint32_t)(baudRate) * 8UL) - 1)
#else
// #define UART_CALC_BAUDRATE(baudRate) (((F_CPU*10UL) / ((baudRate)*16UL) +5)/10 -1)
#define UART_CALC_BAUDRATE(baudRate) ((uint32_t)((F_CPU) + ((uint32_t)baudRate * 8UL)) / ((uint32_t)(baudRate) * 16UL) - 1)
#endif


#include <stdint.h>
#include <avr/io.h>
#include <avr/wdt.h>
@@ -367,6 +376,9 @@ int main(void)
if ((BLPIN & (1<<BLPNUM))) {
// jump to main app if pin is not grounded
BLPORT &= ~(1<<BLPNUM); // set to default
#ifdef UART_DOUBLESPEED
UART_STATUS &= ~( 1<<UART_DOUBLE );
#endif
jump_to_app(); // Jump to application sector

} else {
@@ -392,7 +404,10 @@ int main(void)

if ((BLPIN & (1<<BLPNUM))) {
// jump to main app if pin is not grounded
BLPORT &= ~(1<<BLPNUM); // set to default
BLPORT &= ~(1<<BLPNUM); // set to default
#ifdef UART_DOUBLESPEED
UART_STATUS &= ~( 1<<UART_DOUBLE );
#endif
jump_to_app(); // Jump to application sector
}


+ 0
- 7
mega128.h View File

@@ -10,13 +10,6 @@
#define SIG_BYTE2 0x97
#define SIG_BYTE3 0x02


#ifdef UART_DOUBLESPEED
#define UART_CALC_BAUDRATE(baudRate) ((uint32_t)(F_CPU) / ((uint32_t)(baudRate) *8) -1)
#else
#define UART_CALC_BAUDRATE(baudRate) ((uint32_t)(F_CPU) / ((uint32_t)(baudRate)*16) -1)
#endif

#ifndef UART_USE_SECOND
#define UART_BAUD_HIGH UBRR0H
#define UART_BAUD_LOW UBRR0L

+ 0
- 6
mega128can.h View File

@@ -13,12 +13,6 @@
#define SIG_BYTE3 0x81


#ifdef UART_DOUBLESPEED
#define UART_CALC_BAUDRATE(baudRate) ((uint32_t)(F_CPU) / ((uint32_t)(baudRate) *8) -1)
#else
#define UART_CALC_BAUDRATE(baudRate) ((uint32_t)(F_CPU) / ((uint32_t)(baudRate)*16) -1)
#endif

#ifndef UART_USE_SECOND
#define UART_BAUD_HIGH UBRR0H
#define UART_BAUD_LOW UBRR0L

+ 0
- 7
mega16.h View File

@@ -10,13 +10,6 @@
#define SIG_BYTE2 0x94
#define SIG_BYTE3 0x03


#ifdef UART_DOUBLESPEED
#define UART_CALC_BAUDRATE(baudRate) ((uint32_t)(F_CPU) / ((uint32_t)(baudRate) *8) -1)
#else
#define UART_CALC_BAUDRATE(baudRate) ((uint32_t)(F_CPU) / ((uint32_t)(baudRate)*16) -1)
#endif

#define UART_BAUD_HIGH UBRRH
#define UART_BAUD_LOW UBRRL
#define UART_STATUS UCSRA

+ 0
- 7
mega162.h View File

@@ -16,13 +16,6 @@
#define SIG_BYTE2 0x94
#define SIG_BYTE3 0x04


#ifdef UART_DOUBLESPEED
#define UART_CALC_BAUDRATE(baudRate) ((uint32_t)(F_CPU) / ((uint32_t)(baudRate) *8) -1)
#else
#define UART_CALC_BAUDRATE(baudRate) ((uint32_t)(F_CPU) / ((uint32_t)(baudRate)*16) -1)
#endif

#ifndef UART_USE_SECOND
#define UART_BAUD_HIGH UBRR0H
#define UART_BAUD_LOW UBRR0L

+ 0
- 7
mega169.h View File

@@ -8,13 +8,6 @@
#define SIG_BYTE2 0x94
#define SIG_BYTE1 0x05


#ifdef UART_DOUBLESPEED
#define UART_CALC_BAUDRATE(baudRate) ((uint32_t)(F_CPU) / ((uint32_t)(baudRate) *8) -1)
#else
#define UART_CALC_BAUDRATE(baudRate) ((uint32_t)(F_CPU) / ((uint32_t)(baudRate)*16) -1)
#endif

#define UART_BAUD_HIGH UBRRH
#define UART_BAUD_LOW UBRRL
#define UART_STATUS UCSRA

+ 0
- 7
mega32.h View File

@@ -10,13 +10,6 @@
#define SIG_BYTE2 0x95
#define SIG_BYTE3 0x02


#ifdef UART_DOUBLESPEED
#define UART_CALC_BAUDRATE(baudRate) ((uint32_t)(F_CPU) / ((uint32_t)(baudRate) *8) -1)
#else
#define UART_CALC_BAUDRATE(baudRate) ((uint32_t)(F_CPU) / ((uint32_t)(baudRate)*16) -1)
#endif

#define UART_BAUD_HIGH UBRRH
#define UART_BAUD_LOW UBRRL
#define UART_STATUS UCSRA

+ 0
- 7
mega64.h View File

@@ -10,13 +10,6 @@
#define SIG_BYTE2 0x96
#define SIG_BYTE3 0x02
#ifdef UART_DOUBLESPEED
#define UART_CALC_BAUDRATE(baudRate) (((F_CPU*10UL) / ((baudRate) *8UL) +5)/10 -1)
#else
#define UART_CALC_BAUDRATE(baudRate) (((F_CPU*10UL) / ((baudRate)*16UL) +5)/10 -1)
#endif
#ifndef UART_USE_SECOND
#define UART_BAUD_HIGH UBRR0H
#define UART_BAUD_LOW UBRR0L

+ 0
- 7
mega644.h View File

@@ -12,13 +12,6 @@
#define SIG_BYTE2 0x96
#define SIG_BYTE3 0x09


#ifdef UART_DOUBLESPEED
#define UART_CALC_BAUDRATE(baudRate) ((uint32_t)(F_CPU) / ((uint32_t)(baudRate) *8) -1)
#else
#define UART_CALC_BAUDRATE(baudRate) ((uint32_t)(F_CPU) / ((uint32_t)(baudRate)*16) -1)
#endif

#define UART_BAUD_HIGH UBRR0H
#define UART_BAUD_LOW UBRR0L
#define UART_STATUS UCSR0A

+ 0
- 7
mega8.h View File

@@ -10,13 +10,6 @@
#define SIG_BYTE2 0x93
#define SIG_BYTE3 0x07


#ifdef UART_DOUBLESPEED
#define UART_CALC_BAUDRATE(baudRate) ((uint32_t)(F_CPU) / ((uint32_t)(baudRate) *8) -1)
#else
#define UART_CALC_BAUDRATE(baudRate) ((uint32_t)(F_CPU) / ((uint32_t)(baudRate)*16) -1)
#endif

#define UART_BAUD_HIGH UBRRH
#define UART_BAUD_LOW UBRRL
#define UART_STATUS UCSRA

+ 0
- 6
megaxx4p.h View File

@@ -1,12 +1,6 @@
#ifndef _MEGAxx4_H_
#define _MEGAxx4_H_

#ifdef UART_DOUBLESPEED
#define UART_CALC_BAUDRATE(baudRate) ((uint32_t)(F_CPU) / ((uint32_t)(baudRate) *8) -1)
#else
#define UART_CALC_BAUDRATE(baudRate) ((uint32_t)(F_CPU) / ((uint32_t)(baudRate)*16) -1)
#endif

#ifndef UART_USE_SECOND
/* UART 0 */
#define UART_BAUD_HIGH UBRR0H

+ 6
- 0
readme.txt View File

@@ -30,6 +30,12 @@ Programming-Software (on the "PC-Side"):
* Installation instructions at the end of this file.
3. Dec. 2008 - Version 0.85
* disable U2X before jump to app as suggested be Alexander Döller
* moved UBRR-macros to main.c and changed them. Inspired by code from avr-libc setbaud.
(macros which are commented out (//) are from Pavel Fertser)
6. Nov. 2008 - Version 0.84
* Added definitions for ATmega64 provided by Pavel Fertser - Thanks.

Loading…
Cancel
Save