Blog J.Schweiss

Infosammlung zu .NET- Programmier-Themen & Elektronik


clock Januar 4, 2017 08:13 by author Administrator



clock August 31, 2016 05:15 by author Administrator


Zerties HowToRFM12_ASK

* ethersex HowtoRFM12_ASK

* ethersex RFM12_ASK

* ethersex BifehlerASK

Implementing the ELV FHT Protocol with an RFM23

FHT8V Protocol

Signal Smoothing

clock August 13, 2016 20:30 by author Administrator


SPI Levelshift

clock Juli 16, 2016 07:18 by author Administrator

Design here

Sampling Rate

clock Juli 15, 2016 06:21 by author Administrator



ATMEL–ICE - DebugWire

clock Juni 20, 2016 02:53 by author Administrator


megaAVR (JTAG) DebugOptions

The JTAG interface is enabled using the JTAGEN fuse, which is programmed by default.

OCDEN fuse can be programmed (by default OCDEN is un-programmed)

Arduino-modifications for debugWire

Adventure with “ATATMEL-ICE-PCBA” and ATMEL Studio 7

clock Juni 7, 2016 05:44 by author Administrator

Incircuit-Debugging wäre ja ein schöne Sache …..

Aber warum einfach ….


Ich habe mit das Modell “ATATMEL-ICE-PCBA” hier bestellt:


For nearly 35 USD, nice price … and that is what you get:



No cable included!  100mil Header!


*** ATMEL, Disappointed! ***


Here the PDF Userguide.

There are some (Erfahrungsbericht) additional sites and blogs, experiencing the same mess.

  • The PC immediately recognises the ICE and can read the arduino’s avr settings on the "Tools/Device Programming" via ISP.

    Then i tried to start a debug session: "You cannot debug via ISP. Only the device is programmed. Use debugWIRE for debugging …".

    Ok. Program only … program running. But the arduino bootloader (enabling uploading via arduino’s USB) was gone …

Hmmh. I had seen the DWEN Fuse on the "Tools/Device Programming/Fuses" tab and enabled it.

The fuse was set immediately and i couldn’t access any of the ISP features anymore! Shock! Arduino bricked!?

On the projects settings on the "Tool" tab, there is a setting for ISP or debugWIRE. Enabled debugWIRE –

then i could upload AND debug my application – although transfer is a bit on the slow side. Yay!


-> How to get back to SPI? –> Menu “DEBUG”  - “Disable  debugWire and Close”


But, in sequence:


1.) manual “fabrication” of Header-Cable ( Steckverbinding 2mm 2*5pol auf 2*3pol 2,54 mm SPI use for ATmega328):







4.4.13. debugWIRE Software Breakpoints

The debugWIRE OCD is drastically scaled down when compared to the Atmel megaAVR (JTAG) OCD. This means that it does not have any program counter breakpoint comparators available to the user for debugging purposes. One such comparator does exist for purposes of run-to-cursor and single-stepping operations, but additional user breakpoints are not supported in hardware.

Instead, the debugger must make use of the AVR BREAK instruction. This instruction can be placed in FLASH, and when it is loaded for execution it will cause the AVR CPU to enter stopped mode. To support breakpoints during debugging, the debugger must insert a BREAK instruction into FLASH at the point at which the users requests a breakpoint. The original instruction must be cached for later replacement.

When single stepping over a BREAK instruction, the debugger has to execute the original cached instruction in order to preserve program behavior.

In extreme cases, the BREAK has to be removed from FLASH and replaced later.

All these scenarios can cause apparent delays when single stepping from breakpoints, which will be exacerbated when the target clock frequency is very low.

It is thus recommended to observe the following guidelines, where possible: • Always run the target at as high a frequency as possible during debugging.

The debugWIRE physical interface is clocked from the target clock.

• Try to minimize on the number of breakpoint additions and removals, as each one require a FLASH page to be replaced on the target

• Try to add or remove a small number of breakpoints at a time, to minimize the number of FLASH page write operations

• If possible, avoid placing breakpoints on double-word instructions

4.4.14. Understanding debugWIRE and the DWEN Fuse

When enabled, the debugWIRE interface takes control of the device's /RESET pin, which makes it mutually exclusive to the SPI interface, which also needs this pin. When enabling and disabling the debugWIRE module, follow one of these two approaches:

• Let Atmel Studio take care of things (recommended)

Set and clear DWEN manually (exercise caution, advanced users only!)

Important: When manipulating DWEN manually, it is important that the SPIEN fuse remains set to avoid having to use High-Voltage programming.

So… hardware hooked up? DebugWIRE enabled? Well hell, start debugging. AVR Studio will find all your source code files and give you all the magic you need to single-step and breakpoint operate your Arduino. You’ll find your code has some extras in it you didn’t write, since that’s the nature of the preprocessor that Processing uses to get the code to compile by GCC, but that’s a story for another time.

Arduino:  That’s a lot of words to say "remove a capacitor and it works." from Reset-Line!


Using in my case Arduino-Nano, remove disturbing C4 (100nF / 0603 ) :



Arduino-Nano: Solder out C4 for Reset-Line for debugWire-use!


Because of error message:

“Failed to enter programming mode. ispEnterProgMode: Error status received: Got 0xc0, expected 0x00 (Command has failed to execute on the tool)

           Unable to enter programming mode. Verify device selection, interface settings, target power, security bit, and connections to the target device.”




Two choices on “Tools/Device Programming”:



Pressing “Apply”




Fuses fror Arduino NANO:

If BootRST-fuse is set –> Reset will start at location which is set by BOOTSZ-Fuse! Not at 0x0000 – address!

Don’t touch DWEN!



Next Step  “Start with debugging” fails because DWEN isn’t set yet:



Hitting “YES”-Button:



Ok, switch Nano off and on again!

And voilá (C-Highlevel & Assembler-Debugging) is available:



And how to return to SPI-progamability: 

Press not “Stop Debugging”  but on Menu during debug-mode:


Debug.Disable debugWire and Close” does the trick:  That is the unique location to do this!




I used demo-nonsense-code and didn’set DDRB for PortB, and set it manually afterwards in the PortIO-Window.

Knowing this code will start at begin of flash address-space, i diabled BOOTRST-Fuse and not let point reset-vector to 0x3C00h.


Going onwards ….


clock Juni 1, 2016 23:28 by author Administrator


Electrical Load

clock Mai 29, 2016 22:30 by author Administrator


Article dummy load


clock Mai 16, 2016 21:29 by author Administrator



clock Mai 14, 2016 03:48 by author Administrator

Project und Platine



AVR FuseCalc

clock Mai 8, 2016 19:44 by author Administrator


SMD Marker

clock Mai 1, 2016 20:14 by author Administrator


Component packages


clock April 30, 2016 16:34 by author Administrator



clock April 11, 2016 04:30 by author Administrator



clock Februar 28, 2016 10:59 by author Administrator

Overview Doku

Library Lib2 Moteino



MICRO mit 32U4

Der RFM12B Transceiver wird via SPI-Kommunikation angesprochen. Beim Arduino Uno sind die nötigen Signale (SS, MOSI, MISO, SCK) an den Pins D10 bis D13.
Der Arduino Micro hat als Microcontroller einen ATmega32U4. Die SPI-Schnittstelle ist bei diesem Board direkt auf die 2×3-polige Stiftleiste herausgeführt. Man kann die SPI-Signale also direkt dort abgreifen.
Für die Ansteuerung mit der Jeelib ist auch der ATmega32U4 vorgesehen. Die Pinkonfiguration ist in der Datei RF12.cpp abgelegt. Dieser Teil sieht wie folgt aus.  Es werden die digitalen Pins D14-D17 verwendet.

#elif defined(__AVR_ATmega32U4__) //Arduino Leonardo

#define RFM_IRQ 0     

// PD0, INT0, Digital3

#define SS_DDR DDRB


#define SS_BIT     6   

// Dig10, PB6

#define SPI_SS    17   

// PB0, pin  8, Digital17

#define SPI_MISO  14   

// PB3, pin 11, Digital14

#define SPI_MOSI  16   

// PB2, pin 10, Digital16

#define SPI_SCK   15   

// PB1, pin  9, Digital15

Somit sollte eigentlich alles ohne Anpassungen in der Library lauffähig sein. Einfach den Arduino Micro als Board auswählen und die nötigen Signale am ICSP-Anschluss abgreifen.


IDE Besonderheiten mit “static” etc… und hier

better arduino debugging

clock Februar 9, 2016 15:16 by author Administrator

using printf with this ref


Where the specifier character at the end is the most significant component, since it defines the type and the interpretation of its corresponding argument:

specifier Output Example
d or i Signed decimal integer 392
u Unsigned decimal integer 7235
o Unsigned octal 610
x Unsigned hexadecimal integer 7fa
X Unsigned hexadecimal integer (uppercase) 7FA
f Decimal floating point, lowercase 392.65
F Decimal floating point, uppercase 392.65
e Scientific notation (mantissa/exponent), lowercase 3.9265e+2
E Scientific notation (mantissa/exponent), uppercase 3.9265E+2
g Use the shortest representation: %e or %f 392.65
G Use the shortest representation: %E or %F 392.65
a Hexadecimal floating point, lowercase -0xc.90fep-2
A Hexadecimal floating point, uppercase -0XC.90FEP-2
c Character a
s String of characters sample
p Pointer address b8000000
n Nothing printed.
The corresponding argument must be a pointer to a signed int.
The number of characters written so far is stored in the pointed location.
% A % followed by another % character will write a single % to the stream. %


clock Februar 5, 2016 06:20 by author Administrator


I2C–Hardware Details

clock Januar 9, 2016 20:47 by author Administrator


Sign in