New blog post available at:
https://www.productize.be/driving-ws2812-programmable-rgb-leds-using-hardware-spi/
Tuesday, October 7, 2014
Tuesday, May 13, 2014
a peek inside the shielding can of the Bluegiga BLE113 Bluetooth Low Energy module
In this new blog post I take a quick peek inside a broken BLE113 Bluetooth low energy module.
Labels:
ble,
bluegiga,
bluetooth,
electronics,
lang:en wii fitness,
lowenergy
Friday, March 7, 2014
Bluetooth Low Energy Explorer Tool
Bluetooth Low Energy is all about services and attributes. Exploring these attributes is an interesting way to gain more insight in how a device works and is invaluable for testing. In order to make this process more comfortable a testing tool is invaluable. Hence the BTLE-explorer was born.
continue reading on the Productize Lab blog.
continue reading on the Productize Lab blog.
Monday, January 20, 2014
programming the attiny10 in linux
The attiny10 (and it's brothers attiny4,5 and 9) is a cute little 6-pin SOT23-6 AVR micro-controller. The very tiny footprint and low price makes it interesting as replacement for e.g. the 555 in simple circuits.
Programming it seems to have been quite involved but the more recent gcc supports it just fine, making it finally easier to use. I tested with 4.8.1 downloaded from Atmel, as the one provided by Debian (also 4.8.1) did not yet have the definitions for the attiny10. It seems like the public source tree for the avr tool lags behind quite a bit against the Atmel provided toolchain ...
For programming I'm using an AVRISP-MKII. I updated it to the latest firmware. This updating unfortunately requires avrstudio in windows; programming itself works fine in Linux.. You may also need a recent avrdude. I'm using 6.0.1.
Programming requires that the chip is powered by 5V according to the spec. I can confirm that this is the case because I tried it with 3.3V and it didn't work, it tries to program but fails on verification.
Once programmed the chip runs all the way down to 1.8V.
The pin mapping is pretty obvious:
attiny10 pinout:
attiny10 sitting between a 5050 RGB LED and a 555 timer IC |
Programming it seems to have been quite involved but the more recent gcc supports it just fine, making it finally easier to use. I tested with 4.8.1 downloaded from Atmel, as the one provided by Debian (also 4.8.1) did not yet have the definitions for the attiny10. It seems like the public source tree for the avr tool lags behind quite a bit against the Atmel provided toolchain ...
For programming I'm using an AVRISP-MKII. I updated it to the latest firmware. This updating unfortunately requires avrstudio in windows; programming itself works fine in Linux.. You may also need a recent avrdude. I'm using 6.0.1.
Programming requires that the chip is powered by 5V according to the spec. I can confirm that this is the case because I tried it with 3.3V and it didn't work, it tries to program but fails on verification.
Once programmed the chip runs all the way down to 1.8V.
The pin mapping is pretty obvious:
attiny10 pinout:
- PB0/TPIDATA
- GND
- PB1/TPICLK
- PB2
- VCC
- PB3/RESET
AVRISP-MkII pinout:
- MISO
- VCC
- SCK
- MOSI
- RESET
- GND
And the mapping:
- TPIDATA - MISO
- TPISCK - SCK
- RESET - RESET
- GND - GND
- VCC - VCC
The following C++ code blinks a LED every second on pin PB2:
#include <util/delay.h> #include <avr/io.h> static inline void setup() { // configure PB2 pin PUEB &= ~_BV(PUEB2); // disable Pull-Up DDRB |= _BV(DDB2); // enable Output mode PORTB &= ~_BV(PORTB2); // set output to Low } int main() { setup(); while (true) { PORTB &= ~_BV(PORTB2); _delay_ms(500); PORTB |= _BV(PORTB2); _delay_ms(500); } return 0; }The following makefile builds it and uploads it with the help of avrdude:
# Makefile loosely derived from generated avr toolchain makefile PROG := avrispmkii MCU := attiny10 F_CPU := 1000000 TARGET := blink COMMONFLAGS = -g -Os -funsigned-char -funsigned-bitfields \ -fpack-struct -fshort-enums -Wall -DF_CPU=$(F_CPU) -mmcu=$(MCU) CFLAGS = -std=gnu99 $(COMMONFLAGS) -Wstrict-prototypes \ -Wa,-adhlns=$(<:.c=.lst) \ CXXFLAGS = -std=gnu++11 $(COMMONFLAGS) -fno-exceptions -fno-rtti \ -Wa,-adhlns=$(<:.cc=.lst) \ ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs LDFLAGS = -Wl,-Map=$(TARGET).map,--cref # TODO fuses # FUSE:=-U lfuse:w:0xff:m -U hfuse:w:0xd9:m -U efuse:w:0xff:m AVRDUDE:=avrdude -c $(PROG) -p $(MCU) AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex TC = /your/path/to/avr8-gnu-toolchain-linux_x86_64 CC = $(TC)/bin/avr-gcc CXX = $(TC)/bin/avr-c++ OBJCOPY = $(TC)/bin/avr-objcopy OBJDUMP = $(TC)/bin/avr-objdump SIZE = $(TC)/bin/avr-size default: $(TARGET).hex check: $(AVRDUDE) fuse: $(AVRDUDE) $(FUSE) upload: $(AVRDUDE) $(AVRDUDE_WRITE_FLASH) %.hex: %.elf $(OBJCOPY) -O ihex -R .eeprom $< $@ $(SIZE) $@ .SECONDARY : $(TARGET).elf .PRECIOUS : $(OBJ) %.elf: %.o $(CC) $(CFLAGS) $< --output $@ $(LDFLAGS) %.o : %.c $(CC) -c $(CFLAGS) $< -o $@ %.o : %.cc $(CXX) -c $(CXXFLAGS) $< -o $@ %.s : %.c $(CC) -S $(CFLAGS) $< -o $@ %.o : %.S $(CC) -c $(ALL_ASFLAGS) $< -o $@ clean: -rm *.hex -rm *.lst -rm *.obj -rm *.elf -rm *.oIn action:
Labels:
atmel,
attiny,
attiny10,
avr,
avrdude,
electronics,
hints,
lab,
LED,
programming
Subscribe to:
Posts (Atom)