⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mega162.txt

📁 yampp 7 USB firmware v 2.44 checked, working, latest
💻 TXT
字号:

*************************************************************************
* Using ATmega162 in it native mode (no M161 compatibility) with yampp7 *
*************************************************************************

Theory:
ATmega162 have programmable clock divider, and enable possibility to
change internal clock speed via firmware itself. I add some code to 
firmware to using this feature. After change the CPU crystal, the yampp
keep low power consumption during normal operation (clock speed is 
divided by 2 or 4 during normal operation) and high USB transfer speed
by switching CPU clock to full speed during USB file transfer.

I test it with 14.318MHz crystal ( I'm crazy ??? ) and work fine with 
filetransfer speed about 410kB/s. 12MHz crystal - 380kB/s.
With MMC card and 12MHz crystal I get 140kB/s. Tested in three different
players and in all cases work OK.

*************************************************************************

For use it you must do:

1. If you have installed ATmega161L CPU, change it to ATmega162L.

2. Run yaap or other SPI programmer, connect SPI programmer cable.

3. Change the bootloader to version 3 or higher, in M162 mode. In YAAP 
   click "Detect Device", open new project, click on "Flash" window, 
   choose File -> Load file, and open "y7_boot_M162_mode.hex" file.
   Now click on the Autoprogram icon. If you don't change the bootloader,
   your player will lock after USB firmware updating, and you will need
   disconnect battery for a moment after any firmware update.

4. Next change the CPU fuses to:
   - CKDIV8 fuse PROGRAMMED,
   - BOOTRST fuse PROGRAMMED,
   - BOOTSZ1 fuse PROGRAMMED, (or UNPROGRAMMED for bootloaders ver 5 and 6)
   - SPIEN fuse PROGRAMMED,
   - ALL OTHERS FUSE UNPROGRAMMED
   In YAAP select "Program -> LockBits & Fuses", change the fuse setting
   (PROGRAMMED fuse must have the box checked) and click "Write Fuses". 
   Don't panic if your SPI programmer lost communication after fuse set,
   because now CPU start running at 0.5MHz (4MHz / 8) and SPI programmer
   may be too fast for 0.5MHz CPU clock. Communication via SPI will return
   to normal state after crystal change.

5. Disconnect SPI programmer cable and battery.

6. Change CPU crystal from 4.0Mhz to about 6-15Mhz. Higher is better, but
   not to more :-). I use 14.318MHz, but you may insert 12.288Mhz Crystal
   - the same type as for VS1001. 8MHz is save and work in all cases. 
   10MHz too. If you using an MMC card, with crystals above 12.5MHz you 
   may get trouble with card durnig USB files upload. If this situation 
   occur, change crystal to lower value. Manipulations is safe for hardware,
   but can damage datas on your card.

7. Change cpu type to atmega162 inside "yampp7_usb\makefile" eg:.
   # CPU type
   MCU = atmega162

8. Write your crystal frequency as M162CRYSTAL value in "Constants.h" file.
   Setup M162DIVIDER value dependend of your crystal frequency. 
   Recommended M162DIVIDER values:
   CRYSTAL FREQ.  M162DIVIDER
   6.0 - 11.9 MHz	2
   12.0 - 15.0 MHz	4

9. Recompile firmware, press VOL_UP and VOL_DOWN keys (enable bootloader),
   connect battery, connect USB cable, run yamppLink, and update firmware.

10.Use the player. It should work normally. Next try load some MP3 files,
   and watch on download speed :-)

11.If you get problems during loading MP3 files, you have too high crystal
   frequency. Change crystal to lower frequency and test the player 
   (without firmware change). If work OK, repeat step 8 and 9.

!!! TIP !!!
You can use internal 8MHz RC oscilator without change the crystal.
For this reason the CPU work in the same way as with 8MHz crystal,
but the crystal and two capacitors is not used. You may leave the
old crystal in it place (no components remove needed).
For use this mode you must set fuse in other way. Set fuses to:
- CKSEL0 fuse PROGRAMMED,
- CKSEL2 fuse PROGRAMMED,
- CKSEL3 fuse PROGRAMMED,
- SUT0 fuse PROGRAMMED,
- CKDIV8 fuse PROGRAMMED,
- BOOTRST fuse PROGRAMMED,
- BOOTSZ1 fuse PROGRAMMED, (or UNPROGRAMMED for bootloaders ver 5 and 6)
- SPIEN fuse PROGRAMMED,
- ALL OTHERS FUSE UNPROGRAMMED

And setup in Constants.h :
M162CRYSTAL	8000000
M162DIVIDER 	2


That's all !

*************************************************************************

					   Have fun !!!
					MIS <romek_b@o2.pl>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -