Difference: ChaseLighting (1 vs. 9)

Revision 92019-01-13 - PeterSchmid

Line: 1 to 1
 
META TOPICPARENT name="WebHome"
%DASHBOARD{ section="banner"
Line: 38 to 38
 Pad Byte = FF
Changed:
<
<
>
>
See RaspiElf#Sample_session for how to run chase.
 

How to build the A18 assembler for the Raspberry Pi

Revision 82018-12-07 - PeterSchmid

Line: 1 to 1
 
META TOPICPARENT name="WebHome"
%DASHBOARD{ section="banner"
Line: 59 to 59
  Install the cross assmbler into /usr/local/bin

Added:
>
>
pi@cosmac:~/elf/A18 $ make
 pi@cosmac:~/elf/A18 $ sudo install -m 557 a18 /usr/local/bin pi@cosmac:~/elf/A18 $
Line: 169 to 170
 

Added:
>
>

1802 Assembler Listing (knightrider.lst)

                        ;   TITL   "Chase Lighting (Knight Rider) for Elf Memebership Card"
                        ;      EJCT   60
                        
                              CPU   1802
                        
      NUMBER      EQU   0
                        
                        ;
                        ; Register Definitions:
                        ;
      R0      EQU   0
      R1      EQU   1
      R2      EQU   2
      R3      EQU   3
      R4      EQU   4
      R5      EQU   5
      R6      EQU   6
      R7      EQU   7
      R8      EQU   8
      R9      EQU   9
      R10      EQU   10
      R11      EQU   11
      R12      EQU   12
      R13      EQU   13
      R14      EQU   14
      R15      EQU   15
                        
                        ;
                        ; I/O Port Definitions:
                        ;
      P1      EQU   1
      P2      EQU   2
      P3      EQU   3
      P4      EQU   4
      P5      EQU   5
      P6      EQU   6
      P7      EQU   7   
                        
            ORG   0H
                              
   0000   c0:11000000       LBR    MOVE      ; the branch can be overwritten
   0001   00:00000000
   0002   03:00000011
                           
      MOVE
   0003   e3:11100011       SEX    R3      ; index register R3 for bit pattern point to 30H
   0004   90:10010000       GHI    R0      ; PC high byte is 0
   0005   b3:10110011       PHI    R3
   0006   f8:11111000       LDI    30H
   0007   30:00110000
   0008   a3:10100011       PLO    R3
                        
   0009   f8:11111000       LDI   00000001B   ; bit pattern to move in (0030H)
   000a   01:00000001
   000b   7b:01111011       SEQ         ; shift left
      LOOP
   000c   53:01010011       STR    R3      ; store pattern
   000d   64:01100100       OUT   P4      ; Rx = 0030H, INC Rx
   000e   f8:11111000       LDI    0FFH
   000f   ff:11111111
   0010   a2:10100010       PLO   R2
   0011   6c:01101100       INP   P4
   0012   b2:10110010       PHI    R2      ; R2 wait counter
   0013   23:00100011       DEC   R3
      WAIT
   0014   22:00100010       DEC    R2      ; wait loop about 0.5 s @ 20
   0015   92:10010010       GHI    R2
   0016   3a:00111010       BNZ    WAIT
   0017   14:00010100
                        
   0018   f0:11110000       LDX         ; get pattern
   0019   31:00110001       BQ    LEFT
   001a   23:00100011
      RIGHT
   001b   f6:11110110       SHR
   001c   3a:00111010       BNZ   LOOP
   001d   0c:00001100
   001e   f8:11111000       LDI    00000010B
   001f   02:00000010
   0020   7b:01111011       SEQ   
   0021   30:00110000       BR     LOOP
   0022   0c:00001100
      LEFT
   0023   fe:11111110       SHL
   0024   3a:00111010       BNZ   LOOP
   0025   0c:00001100
   0026   f8:11111000       LDI    01000000B
   0027   40:01000000
   0028   7a:01111010       REQ
   0029   30:00110000       BR   LOOP
   002a   0c:00001100
                        
            END
0023  LEFT          000c  LOOP          0003  MOVE          0000  NUMBER    
0001  P1            0002  P2            0003  P3            0004  P4        
0005  P5            0006  P6            0007  P7            0000  R0        
0001  R1            000a  R10           000b  R11           000c  R12       
000d  R13           000e  R14           000f  R15           0002  R2        
0003  R3            0004  R4            0005  R5            0006  R6        
0007  R7            0008  R8            0009  R9            001b  RIGHT     
0014  WAIT          

 

-- Peter Schmid - 2017-11-18

Line: 180 to 290
 
META FILEATTACHMENT attachment="chase.bin" attr="" comment="" date="1513525694" name="chase.bin" path="chase.bin" size="45" user="PeterSchmid" version="1"
META FILEATTACHMENT attachment="chase.hex" attr="" comment="" date="1513525694" name="chase.hex" path="chase.hex" size="126" user="PeterSchmid" version="1"
META FILEATTACHMENT attachment="chase.lst" attr="" comment="" date="1513525694" name="chase.lst" path="chase.lst" size="3318" user="PeterSchmid" version="1"
Added:
>
>
META FILEATTACHMENT attachment="knightrider.bin" attr="" comment="" date="1544196501" name="knightrider.bin" path="knightrider.bin" size="43" user="PeterSchmid" version="1"
META FILEATTACHMENT attachment="knightrider.hex" attr="" comment="" date="1544196501" name="knightrider.hex" path="knightrider.hex" size="122" user="PeterSchmid" version="1"
META FILEATTACHMENT attachment="knightrider.lst" attr="" comment="" date="1544196501" name="knightrider.lst" path="knightrider.lst" size="3166" user="PeterSchmid" version="1"
META FILEATTACHMENT attachment="knightrider.asm" attr="" comment="" date="1544196578" name="knightrider.asm" path="knightrider.asm" size="1016" user="PeterSchmid" version="1"
 
META TOPICMOVED by="PeterSchmid" date="1513445593" from="Cosmac.MemebershipCard" to="Cosmac.ChaseLighting"

Revision 72017-12-25 - PeterSchmid

Line: 1 to 1
 
META TOPICPARENT name="WebHome"
%DASHBOARD{ section="banner"
Line: 11 to 11
  This is a very simple chase lighting program for the Elf Membership Card. It is mainly used for testing my RaspiElf tools. I use the A18 cross assembler (see below how to get and build the assembler):
Changed:
<
<
pi@cosmac:~/elf/RaspiElf/chase $ a18 chase.asm -Lb1 chase.lst -o chase.hex
>
>
pi@cosmac:~/elf/RaspiElf/chase $ a18 chase.asm -Lb1 chase.lst -o chase.hex

 1802/1805A Cross-Assembler (Portable) Ver 2.5 Copyright (c) 1985 William C. Colley, III Copyright (c) 2017 Mark W. Sherman

No Errors

Changed:
<
<
>
>
  The cross assembler generates two output files: the object file (Intel hex file chase.hex) and the listing file (chase.lst). You can load the program into the Elf Membership Card the traditional way by setting the switches. Or upload it with the RaspiElf bin2elf tool. But for this we need a binary file first. A handy tool is Jacques Pelletier's Hex2bin (see below how to get and install Hex2bin).
Changed:
<
<
pi@cosmac:~/elf/RaspiElf/chase $ hex2bin chase.hex
>
>
pi@cosmac:~/elf/RaspiElf/chase $ hex2bin chase.hex

 hex2bin v2.5, Copyright (C) 2017 Jacques Pelletier & contributors

Allocate_Memory_and_Rewind:

Line: 36 to 36
 Records start = 00000000 Highest address = 0000002C Pad Byte = FF
Changed:
<
<
>
>
 
Line: 45 to 45
 

How to build the A18 assembler for the Raspberry Pi

Get the source from the GIT repository:

Changed:
<
<
pi@cosmac:~/elf $ git clone https://github.com/carangil/A18.git
>
>
pi@cosmac:~/elf $ git clone https://github.com/carangil/A18.git

 Cloning into 'A18'... remote: Counting objects: 81, done. remote: Total 81 (delta 0), reused 0 (delta 0), pack-reused 81 Unpacking objects: 100% (81/81), done. Checking connectivity... done. pi@cosmac:~/elf $
Changed:
<
<
>
>
 If you have not installed GIT yet, then install it with sudo apt-get install git

Install the cross assmbler into /usr/local/bin

Changed:
<
<
pi@cosmac:~/elf/A18 $ sudo install -m 557 a18 /usr/local/bin
>
>
pi@cosmac:~/elf/A18 $ sudo install -m 557 a18 /usr/local/bin

 pi@cosmac:~/elf/A18 $
Changed:
<
<
>
>
 

How to build Hex2bin for the Raspberry Pi

Hex2bin is a Intel Hex or Motorola Hex file converter. You can download the tarball from Sourceforge http://hex2bin.sourceforge.net/.

Unpack the tarball:

Changed:
<
<
pi@cosmac:~/elf $ tar xvjf ~/Downloads/Hex2bin-2.5.tar.bz2 
>
>
pi@cosmac:~/elf $ tar xvjf ~/Downloads/Hex2bin-2.5.tar.bz2

 Hex2bin-2.5/ Hex2bin-2.5/mot2bin.c Hex2bin-2.5/doc/ ... Hex2bin-2.5/mot2bin.layout
Changed:
<
<
>
>
  Build (compile):
Changed:
<
<
pi@cosmac:~/elf $ cd Hex2bin-2.5/
pi@cosmac:~/elf/Hex2bin-2.5 $ make
>
>
pi@cosmac:~/elf $ cd Hex2bin-2.5/
pi@cosmac:~/elf/Hex2bin-2.5 $ make

 gcc -c -std=c99 -O2 -Wall -pedantic hex2bin.c -o hex2bin.o gcc -c -std=c99 -O2 -Wall -pedantic common.c -o common.o gcc -c -std=c99 -O2 -Wall -pedantic libcrc.c -o libcrc.o
Line: 88 to 88
 gcc -O2 -Wall -o hex2bin hex2bin.o common.o libcrc.o binary.o gcc -c -std=c99 -O2 -Wall -pedantic mot2bin.c -o mot2bin.o gcc -O2 -Wall -o mot2bin mot2bin.o common.o libcrc.o binary.o
Changed:
<
<
>
>
  Install:
Changed:
<
<
pi@cosmac:~/elf/Hex2bin-2.5 $ sudo make install
>
>
pi@cosmac:~/elf/Hex2bin-2.5 $ sudo make install

 strip hex2bin strip mot2bin cp hex2bin mot2bin /usr/local/bin cp hex2bin.1 /usr/local/man/man1 pi@cosmac:~/elf/Hex2bin-2.5 $
Changed:
<
<
>
>
 

Revision 62017-12-19 - PeterSchmid

Line: 1 to 1
 
META TOPICPARENT name="WebHome"
%DASHBOARD{ section="banner"
Line: 9 to 9
 

How to build/assemble the chase lighting program

Changed:
<
<
This is a very simple chase lighting program for the Elf Membership Card. It is mainly used for testing my RaspiElf tools. I use the A18 cross assembler (see below how to get and build the assembler):
>
>
This is a very simple chase lighting program for the Elf Membership Card. It is mainly used for testing my RaspiElf tools. I use the A18 cross assembler (see below how to get and build the assembler):
 
pi@cosmac:~/elf/RaspiElf/chase $ a18 chase.asm -Lb1 chase.lst -o chase.hex

Revision 52017-12-17 - PeterSchmid

Line: 1 to 1
 
META TOPICPARENT name="WebHome"
%DASHBOARD{ section="banner" image="/twiki/pub/Velo/MainMCUFirmware/kinetisdesignstudio.png"
Changed:
<
<
title="Main MCU Firmware"
>
>
title="Chase Lighting (Elf Membership Card test program)"
  titlestyle="color:#F00000;" }%
Changed:
<
<

Chase Lighting (Elf Membership Card test program)

>
>

How to build/assemble the chase lighting program

This is a very simple chase lighting program for the Elf Membership Card. It is mainly used for testing my RaspiElf tools. I use the A18 cross assembler (see below how to get and build the assembler):

pi@cosmac:~/elf/RaspiElf/chase $ a18 chase.asm -Lb1 chase.lst -o chase.hex
1802/1805A Cross-Assembler (Portable) Ver 2.5
Copyright (c) 1985 William C. Colley, III
Copyright (c) 2017 Mark W. Sherman

No Errors

The cross assembler generates two output files: the object file (Intel hex file chase.hex) and the listing file (chase.lst). You can load the program into the Elf Membership Card the traditional way by setting the switches. Or upload it with the RaspiElf bin2elf tool. But for this we need a binary file first. A handy tool is Jacques Pelletier's Hex2bin (see below how to get and install Hex2bin).

pi@cosmac:~/elf/RaspiElf/chase $ hex2bin chase.hex
hex2bin v2.5, Copyright (C) 2017 Jacques Pelletier & contributors

Allocate_Memory_and_Rewind:
Lowest address:   00000000
Highest address:  0000002C
Starting address: 00000000
Max Length:       45

Binary file start = 00000000
Records start     = 00000000
Highest address   = 0000002C
Pad Byte          = FF

How to build the A18 assembler for the Raspberry Pi

Get the source from the GIT repository:

pi@cosmac:~/elf $ git clone https://github.com/carangil/A18.git
Cloning into 'A18'...
remote: Counting objects: 81, done.
remote: Total 81 (delta 0), reused 0 (delta 0), pack-reused 81
Unpacking objects: 100% (81/81), done.
Checking connectivity... done.
pi@cosmac:~/elf $ 
If you have not installed GIT yet, then install it with sudo apt-get install git

Install the cross assmbler into /usr/local/bin

pi@cosmac:~/elf/A18 $ sudo install -m 557 a18 /usr/local/bin
pi@cosmac:~/elf/A18 $ 

How to build Hex2bin for the Raspberry Pi

Hex2bin is a Intel Hex or Motorola Hex file converter. You can download the tarball from Sourceforge http://hex2bin.sourceforge.net/.

Unpack the tarball:

pi@cosmac:~/elf $ tar xvjf ~/Downloads/Hex2bin-2.5.tar.bz2 
Hex2bin-2.5/
Hex2bin-2.5/mot2bin.c
Hex2bin-2.5/doc/
...
Hex2bin-2.5/mot2bin.layout

Build (compile):

pi@cosmac:~/elf $ cd Hex2bin-2.5/
pi@cosmac:~/elf/Hex2bin-2.5 $ make
gcc -c -std=c99 -O2 -Wall -pedantic hex2bin.c -o hex2bin.o
gcc -c -std=c99 -O2 -Wall -pedantic common.c -o common.o
gcc -c -std=c99 -O2 -Wall -pedantic libcrc.c -o libcrc.o
gcc -c -std=c99 -O2 -Wall -pedantic binary.c -o binary.o
gcc -O2 -Wall -o hex2bin hex2bin.o common.o libcrc.o binary.o
gcc -c -std=c99 -O2 -Wall -pedantic mot2bin.c -o mot2bin.o
gcc -O2 -Wall -o mot2bin mot2bin.o common.o libcrc.o binary.o

Install:

pi@cosmac:~/elf/Hex2bin-2.5 $ sudo make install
strip hex2bin
strip mot2bin
cp hex2bin mot2bin /usr/local/bin
cp hex2bin.1 /usr/local/man/man1
pi@cosmac:~/elf/Hex2bin-2.5 $

1802 Assembler Listing (chase.lst)

 
                        
Line: 73 to 168
  END
Deleted:
<
<

Copyright

Peter Schmid, Switzerland, peter@spyr.ch

This file is part of "Velo Bling-Bling" main MCU firmware.

"Velo Bling-Bling" firmware is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

"Velo Bling-Bling" is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with "Velo Bling-Bling". If not, see http://www.gnu.org/licenses/.

Tools

Kinetis Design Studio Integrated Development Environment (IDE)

The Kinetis Design Studio (KDS) is a complimentary integrated development environment for Kinetis MCUs that enables robust editing, compiling and debugging of your designs. Based on free, open-source software including Eclipse, GNU Compiler Collection (GCC), GNU Debugger (GDB), and others, the Kinetis Design Studio IDE offers designers a simple development tool with no code-size limitations.

You have to use an old Version (2.0.0, current is 3.2.0) for the veloblingbling project because the Processor Expert USB Stack does not work with newer Kinetis Design Studio Integrated Development Environment.

Processor Expert Software and Embedded Components

Processor Expert Software is a development system to create, configure, optimize, migrate, and deliver software components that generate source code for our (Freescale/NXP) silicon.

Unfortunately the Processor Expert USB Stack v4.1.1 NXP bare metal (no OS) USB Stack is no longer supported. But you can still find it under (ARCHIVED) USB Stack. You need a Windows PC to install, but the Processor Expert components can be used for Linux boxes too, the PEupd files are in the directory C:\Freescale\Freescale USB Stack v4.1.1\ProcessorExpert\Components and have to be imported into the KDS IDE: Processor Expert -> Import Components.

I will migrate the Velo Bling-Bling USB software from Freescale USB Stack v4.1.1 to Erich Styger's USB Stack.

Debug Adapter

The KDS supports following adapters (protocols):

  • OpenSDA Serial and Debug Adapter (proprietary Freescale/NXP/P&E Microcomputer Systems)
  • Segger (industrial standard)
  • OpenOCD,

I propose to use a Freescale/NXP Freedom Board e.g. FRDM-K22F as a debug adapter. I use the OpenOCD/CMSIS-DAP/mbed-interface protocol (factory set on FRDM-K22F).

Quote from Freedom Board for Kinetis K22F Hardware (FRDM-K22F), Users Guide

3.2.1 Debug interface

Signals with SPI and GPIO capability are used to connect directly to the SWD of the K22F. These signals are also brought out to a standard 10-pin (0.05”) Cortex debug connector (J11). It is possible to isolate the K22F MCU from the OpenSDAv2 circuit and use J11 to connect to an off-board MCU. To accomplish this, cut the trace on the bottom side of the PCB that connects J7 pin 2 to J11 pin 4. This will disconnect the SWD_CLK pin to the K22F so that it will not interfere with communication to an off-board MCU connected to J7. The J11 header is populated by default. A mating cable, such as a Samtec FFSD IDC cable, can then be used to connect from the OpenSDAv2 of the FRDM-K22F to an off-board SWD connector.

You can still use the FRDM-K22F as a prototype board. You should solder a pinheader and plug a jumper if you want to use the FRDM-K22F as a prototype board.

See also an excellent introduction to OpenOCD/CMSIS-DAP Debugging by Erich Styger.

Get the Software and Import the Project into the IDE

Get the Source from the Repository

The Velo Bling-Bling Kinetis project is on the GitHub repository https://github.com/spyren/veloblingbling-mcu. Download the ZIP-File and unzip it or better clone the repository e.g. for GNU/Linux:
psi@homer:~/veloblingbling/mcu> git clone https://github.com/spyren/veloblingbling-mcu
Klone nach 'veloblingbling-mcu' ...
remote: Counting objects: 265, done.
remote: Compressing objects: 100% (97/97), done.
remote: Total 265 (delta 167), reused 260 (delta 166), pack-reused 0
Empfange Objekte: 100% (265/265), 223.50 KiB | 0 bytes/s, Fertig.
Löse Unterschiede auf: 100% (167/167), Fertig.
Prüfe Konnektivität ... Fertig.
psi@homer:~/veloblingbling/mcu>

Import the Project into the IDE

File -> Import -> General -> Existing Projects into Workspace ->
Select root directory
Copy project into workspace
Browse to veloblingbling/mcu directory
Finish

I don't know why, but I had to change the Processor Expert system directory:
Window -> Preferences -> Processor Expert -> Paths
system directory /opt/Freescale/KDS_2.0.0/eclipse/ProcessorExpert

Chase Lighting (Elf Membership Card test program)

0000	C0	LBR MOVE
0001	00
0002	03	

MOVE:
0003	E3	SEX R3		; index register R3 for bit pattern point to 30H
0004	90	GHI R0 		; PC high byte is 0
0005	B3	PHI R3
0006	F8	LDI 30H
0007	30
0008	A3	PLO R3

0009	F8	LDI 00000001B	; bit pattern to move in (0030H)
000A	01
000B	53	STR R3
LOOP:
000C	64	OUT4		; Rx = 0030H, INC Rx
000D	6C	INP4		; get switches Rx =0031H
000E	23	DEC R3		; Rx = 0030H
000F	FA	ANI 11111110B
0010	FE
0011	3A	BNZ LEFT
0012    1A
RIGHT:
0013	F0	LDX		; get pattern
0014	F6	SHR
0015	C7	LSNF
0016	F8	LDI 10000000B
0017	80	
0018	30	BR  STORE
0019	1F
LEFT:
001A	F0	LDX		; get pattern
001B	FE	SHL
001C	C7	LSNF
001D	F8	LDI 00000001B
001E	01
STORE:
001F	53	STR R3

0020	F8	LDI 20
0021	14
0022	B2	PHI R2		; R2 wait counter
WAIT:
0023	22	DEC R2		; wait loop about 0.5 s
0024	92	GHI R2
0025	3A	BNZ WAIT
0026	23

0027	C5	LSNQ		; toggle Q
0028	7A	REQ
0029	38	NBR
002A	7B	SEQ
002B	30	BR LOOP	
002C	0C		
 
Line: 239 to 175
 

Comments

Deleted:
<
<
<--/commentPlugin-->
 
Added:
>
>
META FILEATTACHMENT attachment="chase.asm" attr="" comment="" date="1513525694" name="chase.asm" path="chase.asm" size="1050" user="PeterSchmid" version="1"
META FILEATTACHMENT attachment="chase.bin" attr="" comment="" date="1513525694" name="chase.bin" path="chase.bin" size="45" user="PeterSchmid" version="1"
META FILEATTACHMENT attachment="chase.hex" attr="" comment="" date="1513525694" name="chase.hex" path="chase.hex" size="126" user="PeterSchmid" version="1"
META FILEATTACHMENT attachment="chase.lst" attr="" comment="" date="1513525694" name="chase.lst" path="chase.lst" size="3318" user="PeterSchmid" version="1"
 
META TOPICMOVED by="PeterSchmid" date="1513445593" from="Cosmac.MemebershipCard" to="Cosmac.ChaseLighting"

Revision 42017-12-17 - PeterSchmid

Line: 1 to 1
 
META TOPICPARENT name="WebHome"
%DASHBOARD{ section="banner"
Line: 9 to 9
 

Chase Lighting (Elf Membership Card test program)

Added:
>
>
                        
                ORG     0H
                        
   0000   c0:11000000           LBR     MOVE
   0001   00:00000000
   0002   03:00000011
                        
      MOVE
   0003   e3:11100011           SEX     R3              ; index register R3 for bit pattern point to 30H
   0004   90:10010000           GHI     R0              ; PC high byte is 0
   0005   b3:10110011           PHI     R3
   0006   f8:11111000           LDI     30H
   0007   30:00110000
   0008   a3:10100011           PLO     R3
                        
   0009   f8:11111000           LDI     00000001B       ; bit pattern to move in (0030H)
   000a   01:00000001
   000b   53:01010011           STR     R3
      LOOP
   000c   64:01100100           OUT     P4              ; Rx = 0030H, INC Rx
   000d   6c:01101100           INP     P4              ; get switches Rx =0031H
   000e   23:00100011           DEC     R3              ; Rx = 0030H
   000f   fa:11111010           ANI     11111110B
   0010   fe:11111110
   0011   3a:00111010           BNZ     LEFT
   0012   1a:00011010
      RIGHT
   0013   f0:11110000           LDX                     ; get pattern
   0014   f6:11110110           SHR
   0015   c7:11000111           LSNF
   0016   f8:11111000           LDI     10000000B   
   0017   80:10000000
   0018   30:00110000           BR      STORE
   0019   1f:00011111
      LEFT
   001a   f0:11110000           LDX                     ; get pattern
   001b   fe:11111110           SHL
   001c   c7:11000111           LSNF
   001d   f8:11111000           LDI     00000001B
   001e   01:00000001
      STORE
   001f   53:01010011           STR     R3
                        
   0020   f8:11111000           LDI     20
   0021   14:00010100
   0022   b2:10110010           PHI     R2              ; R2 wait counter
      WAIT
   0023   22:00100010           DEC     R2              ; wait loop about 0.5 s
   0024   92:10010010           GHI     R2
   0025   3a:00111010           BNZ     WAIT
   0026   23:00100011
                        
   0027   c5:11000101           LSNQ                    ; toggle Q
   0028   7a:01111010           REQ
   0029   38:00111000           NBR     7bH             ; SEQ 
   002a   7b:01111011
                                        ;SEQ
   002b   30:00110000           BR      LOOP
   002c   0c:00001100
                        
                END
 

Copyright

Line: 108 to 171
 
Deleted:
<
<

MCU MK22DX256VLF5

  • Data sheets
  • Features
    • Core ARM Cortex M4, 50 MHz
    • Run mode current 17 mA, wait 8 mA
    • A/D Converter - Bits (bit) 16
    • Additional Features Vref
    • Ambient Operating Temperature (Min-Max) (°C) -40 to 105
    • Analog Comparator 2
    • Cache (kB) 0
    • Debug Features JTAG, Serial Wire Debug, cJTAG
    • EEPROM (kB) 4
    • External Bus Interface n/a
    • FlexMemory (KB) 64
    • I/O Pins 29
    • Independent ADC modules 1
    • Internal Flash (kB) 256
    • Internal RAM (kB) 32
    • Max Simultaneous ADC channels 1 DP14 SE
    • Pulse Width Modulators - Channels 10
    • Sample Exception Availability Y
    • Serial Interface - Number of Interfaces 4
    • Serial Interface - Type UART, SPI, I2C, I2S
    • USB OTG LS/FS
    • Supply Voltage (Min-Max) (V) 1.71 to 3.6
    • Timer type Low Power Timer, Periodic Interrupt Timer, Programmable Delay Block
    • Total DMA Channels 16
    • Total Flash memory (kB) 320
    • LQFP-48

The MK20DX128VLF5 can also be used, but the memory footprint (Flash and RAM) has to be reduced. The MKL27Z256VFT4 would be an excellent alternative (build-in bootloader, 8 mA run mode current with peripherals, 4 mA wait mode current), but the case is QFN48 and therefore you have to change the PCB layout.

 

Chase Lighting (Elf Membership Card test program)

Changed:
<
<
>
>
%CODE{c}%
 0000 C0 LBR MOVE 0001 00 0002 03
Line: 212 to 231
 002A 7B SEQ 002B 30 BR LOOP 002C 0C
Changed:
<
<
>
>
%ENDCODE%
  -- Peter Schmid - 2017-11-18

Revision 32017-12-17 - PeterSchmid

Line: 1 to 1
 
META TOPICPARENT name="WebHome"
Added:
>
>
Main MCU Firmware

Chase Lighting (Elf Membership Card test program)

Copyright

Peter Schmid, Switzerland, peter@spyr.ch

This file is part of "Velo Bling-Bling" main MCU firmware.

"Velo Bling-Bling" firmware is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

"Velo Bling-Bling" is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with "Velo Bling-Bling". If not, see http://www.gnu.org/licenses/.

Tools

Kinetis Design Studio Integrated Development Environment (IDE)

The Kinetis Design Studio (KDS) is a complimentary integrated development environment for Kinetis MCUs that enables robust editing, compiling and debugging of your designs. Based on free, open-source software including Eclipse, GNU Compiler Collection (GCC), GNU Debugger (GDB), and others, the Kinetis Design Studio IDE offers designers a simple development tool with no code-size limitations.

You have to use an old Version (2.0.0, current is 3.2.0) for the veloblingbling project because the Processor Expert USB Stack does not work with newer Kinetis Design Studio Integrated Development Environment.

Processor Expert Software and Embedded Components

Processor Expert Software is a development system to create, configure, optimize, migrate, and deliver software components that generate source code for our (Freescale/NXP) silicon.

Unfortunately the Processor Expert USB Stack v4.1.1 NXP bare metal (no OS) USB Stack is no longer supported. But you can still find it under (ARCHIVED) USB Stack. You need a Windows PC to install, but the Processor Expert components can be used for Linux boxes too, the PEupd files are in the directory C:\Freescale\Freescale USB Stack v4.1.1\ProcessorExpert\Components and have to be imported into the KDS IDE: Processor Expert -> Import Components.

I will migrate the Velo Bling-Bling USB software from Freescale USB Stack v4.1.1 to Erich Styger's USB Stack.

Debug Adapter

The KDS supports following adapters (protocols):

  • OpenSDA Serial and Debug Adapter (proprietary Freescale/NXP/P&E Microcomputer Systems)
  • Segger (industrial standard)
  • OpenOCD,

I propose to use a Freescale/NXP Freedom Board e.g. FRDM-K22F as a debug adapter. I use the OpenOCD/CMSIS-DAP/mbed-interface protocol (factory set on FRDM-K22F).

Quote from Freedom Board for Kinetis K22F Hardware (FRDM-K22F), Users Guide

3.2.1 Debug interface

Signals with SPI and GPIO capability are used to connect directly to the SWD of the K22F. These signals are also brought out to a standard 10-pin (0.05”) Cortex debug connector (J11). It is possible to isolate the K22F MCU from the OpenSDAv2 circuit and use J11 to connect to an off-board MCU. To accomplish this, cut the trace on the bottom side of the PCB that connects J7 pin 2 to J11 pin 4. This will disconnect the SWD_CLK pin to the K22F so that it will not interfere with communication to an off-board MCU connected to J7. The J11 header is populated by default. A mating cable, such as a Samtec FFSD IDC cable, can then be used to connect from the OpenSDAv2 of the FRDM-K22F to an off-board SWD connector.

You can still use the FRDM-K22F as a prototype board. You should solder a pinheader and plug a jumper if you want to use the FRDM-K22F as a prototype board.

See also an excellent introduction to OpenOCD/CMSIS-DAP Debugging by Erich Styger.

Get the Software and Import the Project into the IDE

Get the Source from the Repository

The Velo Bling-Bling Kinetis project is on the GitHub repository https://github.com/spyren/veloblingbling-mcu. Download the ZIP-File and unzip it or better clone the repository e.g. for GNU/Linux:
psi@homer:~/veloblingbling/mcu> git clone https://github.com/spyren/veloblingbling-mcu
Klone nach 'veloblingbling-mcu' ...
remote: Counting objects: 265, done.
remote: Compressing objects: 100% (97/97), done.
remote: Total 265 (delta 167), reused 260 (delta 166), pack-reused 0
Empfange Objekte: 100% (265/265), 223.50 KiB | 0 bytes/s, Fertig.
Löse Unterschiede auf: 100% (167/167), Fertig.
Prüfe Konnektivität ... Fertig.
psi@homer:~/veloblingbling/mcu>

Import the Project into the IDE

File -> Import -> General -> Existing Projects into Workspace ->
Select root directory
Copy project into workspace
Browse to veloblingbling/mcu directory
Finish

I don't know why, but I had to change the Processor Expert system directory:
Window -> Preferences -> Processor Expert -> Paths
system directory /opt/Freescale/KDS_2.0.0/eclipse/ProcessorExpert

MCU MK22DX256VLF5

  • Data sheets
  • Features
    • Core ARM Cortex M4, 50 MHz
    • Run mode current 17 mA, wait 8 mA
    • A/D Converter - Bits (bit) 16
    • Additional Features Vref
    • Ambient Operating Temperature (Min-Max) (°C) -40 to 105
    • Analog Comparator 2
    • Cache (kB) 0
    • Debug Features JTAG, Serial Wire Debug, cJTAG
    • EEPROM (kB) 4
    • External Bus Interface n/a
    • FlexMemory (KB) 64
    • I/O Pins 29
    • Independent ADC modules 1
    • Internal Flash (kB) 256
    • Internal RAM (kB) 32
    • Max Simultaneous ADC channels 1 DP14 SE
    • Pulse Width Modulators - Channels 10
    • Sample Exception Availability Y
    • Serial Interface - Number of Interfaces 4
    • Serial Interface - Type UART, SPI, I2C, I2S
    • USB OTG LS/FS
    • Supply Voltage (Min-Max) (V) 1.71 to 3.6
    • Timer type Low Power Timer, Periodic Interrupt Timer, Programmable Delay Block
    • Total DMA Channels 16
    • Total Flash memory (kB) 320
    • LQFP-48

The MK20DX128VLF5 can also be used, but the memory footprint (Flash and RAM) has to be reduced. The MKL27Z256VFT4 would be an excellent alternative (build-in bootloader, 8 mA run mode current with peripherals, 4 mA wait mode current), but the case is QFN48 and therefore you have to change the PCB layout.

 

Chase Lighting (Elf Membership Card test program)

Revision 22017-12-16 - PeterSchmid

Line: 1 to 1
 
META TOPICPARENT name="WebHome"
Changed:
<
<

Membership Card

>
>

Chase Lighting (Elf Membership Card test program)

 
Line: 67 to 67
 

Comments

<--/commentPlugin-->
\ No newline at end of file
Added:
>
>
META TOPICMOVED by="PeterSchmid" date="1513445593" from="Cosmac.MemebershipCard" to="Cosmac.ChaseLighting"

Revision 12017-11-18 - PeterSchmid

Line: 1 to 1
Added:
>
>
META TOPICPARENT name="WebHome"

Membership Card

0000   C0   LBR MOVE
0001   00
0002   03   

MOVE:
0003   E3   SEX R3      ; index register R3 for bit pattern point to 30H
0004   90   GHI R0       ; PC high byte is 0
0005   B3   PHI R3
0006   F8   LDI 30H
0007   30
0008   A3   PLO R3

0009   F8   LDI 00000001B   ; bit pattern to move in (0030H)
000A   01
000B   53   STR R3
LOOP:
000C   64   OUT4      ; Rx = 0030H, INC Rx
000D   6C   INP4      ; get switches Rx =0031H
000E   23   DEC R3      ; Rx = 0030H
000F   FA   ANI 11111110B
0010   FE
0011   3A   BNZ LEFT
0012    1A
RIGHT:
0013   F0   LDX      ; get pattern
0014   F6   SHR
0015   C7   LSNF
0016   F8   LDI 10000000B
0017   80   
0018   30   BR  STORE
0019   1F
LEFT:
001A   F0   LDX      ; get pattern
001B   FE   SHL
001C   C7   LSNF
001D   F8   LDI 00000001B
001E   01
STORE:
001F   53   STR R3

0020   F8   LDI 20
0021   14
0022   B2   PHI R2      ; R2 wait counter
WAIT:
0023   22   DEC R2      ; wait loop about 0.5 s
0024   92   GHI R2
0025   3A   BNZ WAIT
0026   23

0027   C5   LSNQ      ; toggle Q
0028   7A   REQ
0029   38   NBR
002A   7B   SEQ
002B   30   BR LOOP   
002C   0C      

-- Peter Schmid - 2017-11-18

Comments

<--/commentPlugin-->
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback