Création d'une application pour le Badge
4.4
Creating an Application for the Badge To create
software that can be downloaded to the badge using the bootloader, there are a few guidelines that must
be met. The LEDApp.zip and JM_Badge_Board.zip CodeWarrior projects have
been provided as templates for development. It is highly recommended to
start custom software designs with one of those projects. 4.4.1 Software Requirements There are severai important things that must be done for a
custom application to download and work correctly with the badge bootloader. This includes setting up the
interrupts, ensuring the code is called from the correct place, and
checking the code size. 4.4.1.1 Interrupts All
interrupts that will be used in the project must be declared in the main.c file. This file can be found in
<Project Directory>/Sources/main.c In that
file, there is an array called “RAM_vector[
]” that contains the re-directs to all the interrupt handler routines.
For the interrupt that is to be used, replace “dummy_ISR”
with the name of the interrupt function that should be used instead. For example,
in the LED_App project, the RTC interrupt
(Vector 91) is using the “rtc_interrupt”
function. This function will be called any time an RTC interrupt
occurs. This is the only change that is required that is specific to
the badge board in order to use interrupts. 4.4.1.2 Application Code All user
application code must be called from a specific place in main.c. This file can be found in
<Project Directory>/Sources/main.c In the main(void) function, there are two large comment
blocks that signal the beginning and end of where the application code
should begin and end executing. The code may call any functions from
within this block, so there is no need to put all the code in the main.c file. 4.4.1.3 Code Size As can be
seen in the project.lcf linker file, the bootloader takes up the flash addresses from 0x00000000
to 0x00003800. This leaves addresses 0x00003800 to 0x00020000 for
application code. There is
also Ox3EOO bytes of RAM space available Iocated
from 0x00800200 to 0x00804000.
See the linker file for more information.
See Section 4.3.1 for
how to use get an S19 file and load it
on the board. 4.4.3 Initialization code It is highly
recommended to keep the sys init() function
from the sample projects when developing custom projects. This sets up
the GPIO pins correctly for the badge board, and ensures very 10w power
consumption. Certain pins (particularly PTF2, which is connected to the
magnetic buzzer), can have very dramatic affects on current draw. Note that
the initialization function turns off all system docks except KBI and
IRQ. The other module docks are only turned on when needed. See the
SCGC1, SCGC2, and SCGC3 register descriptions in Section 5.7.8 of the
MCFS1JM128 Reference Manual for more information. The dock is
also set up to use Bypassed Low Power External (BLPE) mode, with a bus
dock speed of 750 Hz. See Chapter 7 of the MCFS1JM128 Reference Manual
for more information. 4.4.4 Useful
Information The JM_Badge_Board.zip project contains sample code
for using the touch sensor, accelerometer, battery charger, speaker,
and scrolling messages across the LED Matrix. This should help get
custom designs up and running quickly. For simple
debugging, you can use the LED Matrix. PTAD controls which rows are
activated. • PTAD=0x00
means no LED5 will light up. • PTAD=0x01
will activate the 1st row. • PTAD=0x02
will activate the 2nd row • PTAD=0x1F
will activate all the rows. PTED and
PTDD control which column is lit. PTED controls the left 8 columns.
PTDD controls the right 8 columns. First negate the value to display,
and then hold the badge upside-down to correctly read the value. •
PTED=~(0x01) will light up the left most column (Column #1) •
PTED=~(0x03) will light up the two left most
columns (columns #1 and #2) •
PTDD=~(0x80) will light up the right most column (Column #16) •
PTDD=~(0x01) will light up column #9 See the page
for important information on issues with the bootloader
and workarounds. |
|
4.4 Création d'une application
pour le Badge 4.4.1 Nécessités logicielles 4.4.1.1 Interruptions 4.4.2
Chargement d'une application sur le Badge 4.4.4
Informations utiles Pour le déboguage simple,
vous pouvez utiliser la matrice de LED. PTAD contrôle les lignes qui
sont activées. • PTAD = 0x00 signifie
qu’aucune LED5 ne s'allume. PTED et PTDD contrôle
quelle colonne est allumée. PTED contrôle les 8 colonnes de gauche.
PTDD contrôle les 8 colonnes de droite. Tout d'abord supprimez la
valeur à afficher, puis maintenez le badge à l'envers pour lire
correctement la valeur. Voir la page des Badge Errata pour des informations importantes sur le bootloader et les environnements de travail. |