Monday, July 5, 2010

NGW100 AVR32 SDK modified from tolchain216

I recently started programming for avr32, for this reason I bought a motherboard NGW100, searching the internet for AVr32 AP7000 documentation I found the package libraries and drivers tolchain216, looking through it I noticed that this is not too arranged, so i begin to arrange libraries and drivers by category and the result can be downloaded below.
NGW100 AVR32 SDK from tolchain216 V1.0

Thursday, May 20, 2010

Mp3 player with ATmega64, Vs1011 & Samsung E700 display

This MP3 player is an upgrade to this player . New in this player is a new nice interface with bitmaps from media player windows 7 and windows 7 battery icons.





I preferred to use bitmaps for interface because in future i want to be possible to change the skin interface from SD card, in this case is more simple to create skins for this player.

V1.0.1A

A little correction for used times for back light, keyboard and battery showing.

Download MP3 PlayerV1.0.1A

V1.0.1

This version player is made to use ASM_SDK V1.0.4 and prepared to work with multiple opened files.

Download MP3_PlayerV1.0.1

From here you can download ASM_SDK.
With ASM_SDK 1.0.5 or newest version you can play from SDHC high capacity > 4GB, at the frequency of only 6 MHz you can play 320Kb/s bit rate melody's.

V1.0.0From here you can download the first source code for this player.To compile this player is necessarily to download and include ASM SDK from here, this version is made to use ASM_SDK V1.0.3.

Thursday, May 6, 2010

Micro Hex Bootloader for ATmega microcontrollers

New in 1.1 version:

The boot loader from microcontroller can report 5 different errors:
  1. LineDefError = One line is not have the defined destination.
  2. SecondHexCharNotFound = If first hex char is found but second hex char is not found or is not one hex char.
  3. CheckSum = If in one line is detected one check sum error.
  4. LineMismach = After conversion from hex to bin If total length line - 5 is not equal to data bytes contained by that line.
  5. NoMemorySelected = If user is trying to write in memory but the user is not sends the command to select Flash or EEProm memory.
Resources:
  • Flash = 852 Bytes For Atmega8( The fusible for jumping in boot loader is necessarily to set to 512 Words ).
  • Flash = 860 Bytes For Uart0 Atmega64-128( The fusible for jumping in boot loader is necessarily to set to 512 Words ).
  • Flash = 878 Bytes For Uart1 Atmega64-128( The fusible for jumping in boot loader is necessarily to set to 512 Words ).

From this moment the source code is ready to download for free.
To compile this boot loader is necessarily to use last ASM SDK.
This Bootloader has maximum 512Words(1KB) of flash and can work on controllers listened down:

ATmega48 Not Tested
ATmega48P Not Tested
Atmega8 Not Tested
Atmega8A Not Tested
ATmega88 Not Tested
ATmega88A Not Tested
ATmega88PA Not Tested
ATmega16 Not Tested
ATmega16A Not Tested
ATmega162 Not Tested
ATmega168 Not Tested
ATmega168A Not Tested
ATmega168PA Not Tested
ATmega32 Not Tested
ATmega32A Not Tested
ATmega64 OK
ATmega64A Not Tested
ATmega640 Not Tested
ATmega128 OK
ATmega128A Not Tested
ATmega1281 Not Tested
ATmega1280 Not Tested
ATmega2561 Not Tested
ATmega2560 Not Tested

Download Bootloader V1.1 ASM Source code and PC uploader C# source code.


First version V1.0

This is an utility that eliminate the ISP programmer for ATmega Microcontrollers and he work even on Windows Vista and Windows 7.

This boot loader is created to upload data in hex format no bin like others boot loaders, to convert from hex to bin is used an function integrated in boot loader not in up loader.

Version ( V1.0 ) is capable to write flash and eeprom (.hex and .eep) generated by AVR Studio and AVR GCC.

The .eep file is detected automatically by the program from the name of .hex file, for this reason is necessarily to select only .hex file.

When this boot loader is present on an ATmega microcontroller ,at reset is booting in boot loader and is programed to stay and wait for "BootInit" + Cr for entering in programed mode for 2 seconds, if "BootInit" + Cr is not received the boot loader jumps to address 0 in flash.

If communication is interrupted more than 2 seconds this boot loader jump to address 0 of flash.

The boot loader from microcontroller can report 4 different errors that can be appear:
  1. LineDefError = One line is not have the defined destination.
  2. SecondHexCharNotFound = If first hex char is found but second hex char is not found or is not one hex char.
  3. CheckSum = If in one line is detected one check sum error.
  4. LineMismach = After conversion from hex to bin If total length line - 5 is not equal to data bytes contained by that line.
Resources:
Flash = 952 Bytes For Uart1 ( The fusible for jumping in boot loader is necessarily to set to 512 Words ).

Down is ready to download 2 Hex demo files that contain the boot loader for ATmega64 at 16Mhz and 8Mhz at Baud rate 19200b/s for Uart1

Download PC uploader V1.0
Download BootLoader for ATmega64 8Mhz Uart1 19200b/s V1.0
Download BootLoader for ATmega64 16Mhz Uart1 19200b/s V1.0

Complete File to Hex converter

I've made this converter because I've searched on the internet looking for a converter that converts one file.bmp with header in decimal or hex and i didn't find it. This converter convert a file.bmp in a file.asm with all the additions ".db" for declaration constants.

The result file contains all the bytes converted without exception.
The name of the result file is: 'name of file converted.asm' for AvrASM ex: test.bmp is saved test.bmp.asm









Because I've been asked about a AvrGcc converter, i have created a program for converting in .h files
The name of the result file is: 'the name of file converted.h' for AvrGCC ex: test.bmp is saved test.bmp.h










This is the result for AvrASM:
















This is the result for AvrGCC:















FileConverterToHexAvGCC_V1.1.zip

Multifunctional 20 Band Audio Spectrum Analyzer V3.0.x

This project is a version 3 firmware and hardware upgrade spectrum analyzer with 20 audio band of 20 levels each and includes other functions and utilities improvements.


From Digital electronics and programing
From Digital electronics and programing



On future:
  1. Option to put five, ten or more of this boards, each board filtering one frequency, rotated by ninety degrees to obtain large size of panel for disco or other purposes.
  2. Ability to display a text message received on the serial unit.
  3. Ability to display time during sleep.
  4. Function to adjust the signal level manually.
  5. Ability to wake up from standby function if signal input is detected.
  6. Ability to enter standby mode in the absence of input signal.
  7. Ability to export using the serial unit, the levels displayed on the local display.
And many many other functions...........

V3.2
On this update has been added AGC function(Automatic Gain Control), this function allow the spectrum analyzer to work with signals between 80 and 1000mV without external signal conditioner or external signal regulator.
This function can not be turned off from menu settings.

With this update you can download an update for PC client of the up-loader for  this spectrum analyzer, please go here to download this software.


V3.1
Is renamed because is one big step from filters combined (digital & analog) to completely digital filtering.
Added functions:
  1. Ability to enter in standby from menu.
  2. Change from help of analog circuits to filter audio bands to completely digital filtering bands, without the help of analog filtering circuits ( this improve the stability of the displayed bands ) .

V3.0.3

Added functions:
  1. Improve speed of way to display levels of frequencies 0,1 & 2.
  2. Ability to set the start-up light when is connected to power supply.
  3. Ability to set-up the horizontal way to display the levels of frequencies, normal or mirrored for stereo use, the way is memorized for start-up config.
V3.0.2

Functions:
  1. Eleven different ways of displaying the levels of frequencies.
  2. Five modes(ways) of display luminance.
  3. Ability to set the star-up mode when is connected the power supply.
V3.0.0 & V3.0.1 generic versions( discarded ).

Wednesday, May 5, 2010

ASM SDK

V1.0.5Added functions:
  1. "IO_Driver_20x20LedDisplay.asm" Added function "_PaintVerticalBarToVideoRamDnLeft" display one bar with R16 col pozition and R18 Length.
  2. "IO_Driver_20x20LedDisplay.asm" Added function "_PaintVerticalBarToVideoRamUpLeft" display one bar with R16 col pozition and R18 Length.
  3. "IO_Driver_20x20LedDisplay.asm" Added function "_SleepDisplay" to sleep display to deactivate scanning of matriceal display.
  4. "IO_Driver_20x20LedDisplay.asm" Added function "_WeekDisplay to resume from sleep.
  5. "IO_Driver_20x20LedDisplay.asm" Added function "_DisplaySecondaryRam" I added a secondary ram buffer to prevent flicker when you write to video ram.
  6. "IO_Driver_20x20LedDisplay.asm" Added function "_Display_TransferDataToDisplay_True" This allow to transfer data from secondary buffer to video ram buffer.
  7. "IO_Driver_20x20LedDisplay.asm" Added function "_Display_TransferDataToDisplay_False" This block transfersof data from secondary buffer to video ram buffer.
  8. "IO_Adc.inc" Added function ".Macro _Macro_Adc_Sleep" to sleep internal ADC.
  9. "IO_Adc.inc" Added function "_Macro_Adc_Week" to resume from sleep internal ADC.
Optimizations:
  1. "IO_SdDriver.asm" Added support for SDHC High capacity > 4GB ( tested with one Kingston SDC4/16GB 02, MicroSD 16GB Class 4)
V1.0.4Added functions:
-In "Drivers/IO_Driver_20x20LedDisplay.asm" non multiplexed 20x20 led display.

Options:
-In "Lib/Util.inc" Option to eliminate non used memory type.

Optimizations:
-In "System/SoftTimers.asm" optimized tick function.
-One important optimization on Fat32 FFS
may allow programmers to work with allocation table management library and data management library fully dynamic, now with this optimization the use can mount infinite discs on single microcontroller, the limit is only the ram memory.

Added library:
-"System/Vectors.inc"is a macro functions to help programmers to place vectors more simply.
-"Drivers/IO_ADC.asm" and "IO_ADC.inc"is a generic driver to work with internal hardware ADC.

Bug fix:
-"IO_VS1011a.asm" fix an error that "VS1011GetBitrate" function return's 0 if the table of bitrate constant is called one part on Zh and another part on Zh+1


An example to use Fat32 FFS with multiple disks:
_Fat32_IndexManagement_RamAlloc IndexManagementLibraryRamDisk1
_Fat32_IndexManagement_RamAlloc IndexManagementLibraryRamDisk2
_Fat32_DataManagement_RamAlloc RamToFat32DataPlayerDisk1
_Fat32_DataManagement_RamAlloc RamToFat32DataPlayerDisk2
_Fat32_Mount IndexManagementLibraryRamDisk1
_Fat32_Mount IndexManagementLibraryRamDisk2
_Fat32_SesionInit IndexManagementLibraryRamDisk1, RamToFat32DataPlayerDisk1
_Fat32_SesionInit IndexManagementLibraryRamDisk2, RamToFat32DataPlayerDisk2

On every change of working disks is necessary to point in Zl:Zh the data management library allocated ram like that:
_Fat32_DataManagement_GetRamAddress RamToFat32DataPlayerDisk1
Code to work with this disk...................
_Fat32_DataManagement_GetRamAddress RamToFat32DataPlayerDisk2
Code to work with this disk...................

This is cool because you can copy one file from one disk to another.

With this new optimization you can open two or more files on same disk, one example is this:
_Fat32_IndexManagement_RamAlloc IndexManagementLibraryRamDisk1
_Fat32_DataManagement_RamAlloc RamToFat32DataPlayerDisk1
_Fat32_DataManagement_RamAlloc RamToFat32DataPlayerDisk2
_Fat32_Mount IndexManagementLibraryRamDisk1
_Fat32_SesionInit IndexManagementLibraryRamDisk1, RamToFat32DataPlayerDisk1
_Fat32_SesionInit IndexManagementLibraryRamDisk1, RamToFat32DataPlayerDisk2
_Fat32_DataManagement_GetRamAddress RamToFat32DataPlayerDisk1
Code to work with this disk................... Get byte from file 1
_Fat32_DataManagement_GetRamAddress RamToFat32DataPlayerDisk2
Code to work with this disk................... Write byte to file 2



Download SDK 1.0.4


V1.0.3
-Added battery paint with 9 bitmap levels and charge bitmap,this function can be called from Dx.asm, before calling this function in R16 is necessarily to lead level:

  1. BatteryEmpty
  2. Battery1
  3. Battery2
  4. Battery3
  5. Battery4
  6. Battery5
  7. Battery6
  8. Battery7
  9. BatteryFull
  10. BatteryCharge
-Verified software timers from one hardware timer: this function is like timers from C,C++,C#,Delphi and others programing languages, example:

.Dseg
TimeToEsantionBattery: .Byte 8; Reserve ram for this timer
TimeToTurnOffLight: .Byte 8
; Reserve ram for this timer
.Cseg


Ldi R16,Low(1000); Hardware timer tick /1000
Ldi R17,Byte2(1000)
Ldi R18,Byte3(1000)
Ldi R19,Byte4(1000)
Ldi Yl,Low(TimeToEsantionBattery)
Ldi Yh,High(TimeToEsantionBattery)
CallLib _SoftTimer,_SoftTimer_Init

Ldi R16,Low(10000); Hardware timer tick /10000
Ldi R17,Byte2(10000)
Ldi R18,Byte3(10000)
Ldi R19,Byte4(10000)
Ldi Yl,Low(TimeToTurnOffLight)
Ldi Yh,
High(TimeToTurnOffLight)
CallLib _SoftTimer,_SoftTimer_Init

Main:
Wdr
Ldi Yl,Low(TimeToTurnOffLight)
Ldi Yh,
High(TimeToTurnOffLight)
CallLib _SoftTimer,_SoftTimer_Tick
Rcall TurnOffLight

Ldi Yl,Low(TimeToEsantionBattery)
Ldi Yh,
High(TimeToEsantionBattery)
CallLib _SoftTimer,_SoftTimer_Tick
Rcall EsantionBattery
Rjmp Main

TurnOffLight:
; Routine to execute tick
Ret
EsantionBattery:
; Routine to execute tick
Ret


To disable one timer use this example:
Ldi Yl,Low(TimeToTurnOffLight)
Ldi Yh,
High(TimeToTurnOffLight)
CallLib _SoftTimer,_SoftTimer_Disable

To enable one timer use this example:
Ldi Yl,Low(TimeToTurnOffLight)
Ldi Yh,
High(TimeToTurnOffLight)
CallLib _SoftTimer,_SoftTimer_Enabled



This timers is enabled when is initiated.

Download SDK 1.0.3


V1.0.2-Added SDHC support in SD card driver,
-Added support for dynamically MBR location in Fat32 Filesystem library.

Download SDK 1.0.2

V1.0.1A
This litle update is a modification in Internal EEProm Driver file to work with more microcontrollers.

Download SDK 1.0.1A

V1.0.1
  1. Fat32file system Read and write with 3 modes of ram allocation. OK Doc RO
  2. BTM bluetooth driver. Not finished ( Some functions not proved )
  3. Samsung E700 TFT color display driver. OK Doc RO
  4. Nokia 6100 display driver. Not completed (No 24Bit ink support ) Doc RO
  5. HD44780 display driver. Not completed ( no optimization )
  6. External I2C EEProm driver. OK
  7. Internal eeprom driver. OK
  8. Macro eeprom driver. OK
  9. Joystick 5 direction driver. OK
  10. General IO utility driver. OK
  11. SD card driver in SPI mode. OK
  12. Hardware SPI driver Macro mode. OK
  13. Software SPI driver macro mode. Not tested
  14. Uart hardware driver in macro mode. OK
  15. VS 10xx driver. OK
  16. (Added) 20x20 multiplexed matrix led display with 5 x 74hc574.
Library:
  1. Variable conversion library. OK
  2. Direct X library to work with display drivers included in this SDK. OK
  3. Mathematics library. Not finished ( Some functions not proved )
  4. Utility library. OK Doc RO Doc EN
System:
  1. Internal EEProm file system. OK
  2. Software ram disk file system. OK
  3. Software timers created from one hardware timer. Not tested
Dx.asm is more important graphic management file from this sdk, because this file has an numerous utility functions to display:
  1. Function to display characters in 8x6 pix format with variable weight.
  2. Function to display strings using function from point 1.
  3. Function to create menu bar with catted corners full or empty, one color for margins and one for internal.
  4. Function to paint an line with an color (not finished).
  5. Function to paint an bitmap in 8 or 24 bit format, stored in Internal Ram memory, Internal EEProm memory, Internal Flash memory, external serial flash memory(not finished), external serial EEprom memory(not finished) or SD memory card(not finished), is necessary to store entire bitmap not converted to bin or others formats( one utility to convert an entire bitmap to hex asm or c for avr can be found here ).
  6. Function to display an progress bar created only from bitmaps stored in one of memories from point 5, this progress bar looks like progress from last MP3 player created by me and found here.
Download SDK 1.0.1

V1.0.0
This ASM SDK created by me is a group of library and drivers that contain:
Version 1.0
Drivers:
  1. Fat32 file system Read and write with 3 modes of ram allocation. OK Doc RO
  2. BTM bluetooth driver. Not finished ( Some functions not proved )
  3. Samsung E700 TFT color display driver. OK Doc RO
  4. Nokia 6100 display driver. Not completed (No 24Bit ink support ) Doc RO
  5. HD44780 display driver. Not completed ( no optimization )
  6. External I2C EEProm driver. OK
  7. Internal eeprom driver. OK
  8. Macro eeprom driver. OK
  9. Joystick 5 direction driver. Not tested
  10. General IO utility driver. OK
  11. SD card driver in SPI mode. OK
  12. Hardware SPI driver Macro mode. Not tested
  13. Software SPI driver macro mode. Not tested
  14. Uart hardware driver in macro mode. OK
  15. VS 10xx driver. OK
Library:
  1. Variable conversion library. OK
  2. Direct X library to work with display drivers included in this SDK. Not tested
  3. Mathematics library. Not finished ( Some functions not tested )
  4. Utility library. OK Doc RO Doc EN
System:
  1. Internal EEProm file system. OK
  2. Software ram disk file system. OK
  3. Software timers created from one hardware timer. Not tested
Download SDK 1.0.0