HOLT HI-6131 API User manual

AN-6131API Rev. A Holt Integrated Circuits
HI-6131 API
Application Development Kit
December 2018

AN-6131API
2 Holt Integrated Circuits
REVISION HISTORY
Revision
Date
Description of Change
AN-6131API, Rev. New
06-07-16
Initial Release
AN-6131API, Rev. A
12-12-18
Rename API Library file to coincide with software update.
HI-613x API LIB.a

AN-6131API
3 Holt Integrated Circuits
Introduction
The Holt ADK-6131API Application Development Kit demonstrates the broad feature set of the HI-6131
Multi Terminal IC for MIL-STD-1553. The 2-board assembly and C project software reference design
provide a ready-to-run evaluation platform demonstrating concurrent operation for any combination of
Bus Controller, Bus Monitor and one or two Remote Terminals. For convenience, this kit includes IAR
Systems Embedded Workbench® for ARM, and a fully integrated debug interface for the ARM Cortex M3
microcontroller.
This guide describes how to set up and run the board. Additional support material and all required project
software are found in the included Holt CD-ROM. A version of the demonstration software is already
programmed into the microcontroller flash; the board is operational right out of the box without installing
or running the provided software development tools.
The ADK-6131API ADK demonstrates the Holt API library on the same hardware as the ADK-6131
development kit. The ADK-6131 kit development uses low level 6131 drivers and demonstration code
written in ANSI ‘C’ without high level APIs. See document AN-6131.pdf for more information on this kit.
This guide describes how to set up and run the board. Additional support material and all required project
software are found in the included Holt CD-ROM. A version of the demonstration software is already
programmed into the microcontroller flash; the board is operational right out of the box without installing
or running the provided software development tools.

AN-6131API
4 Holt Integrated Circuits
Evaluation Kit Contents
This User Guide.
Holt Demo and Holt API Software Projects and Documentation CD.
oHI-613x API LIB runtime library
oHI-6131 API Demo example project
Installation CD for IAR Systems Embedded Workbench® for ARM, version 7.1 or greater. See
installation guide “Holt HI-6131 API project installation guide” for important instructions.
Plug-in 5V DC power supply and USB debug interface cable.
RS-232 serial cable, DB-9M to DB-9F for console I/O using a connected computer.
2-board assembly comprised of:
oUpper TARGET board with HI-6131 device and dual transformer-coupled MIL-STD-1553 bus
interfaces. Numerous DIP switches configure board operation.
oLower MCU board with ARM Cortex M3 16-/32-bit microprocessor, debug interface and
regulated 3.3VDC power supply
Hardware Block Diagram
MIL-STD-1553
BusA
MIL-STD-1553
BusB
Serial Peripheral
Interface
4Signals
DIP Switches
StatusSignals,
Interrupts, Etc.
USB
Debug Port
RS-232Serial
ConsoleI/O
User
Pushbuttons (3)
Status
LEDs(2)
Control
Signals
64K Byte
Serial
EEPROM
HOLT
HI-6131
ARM
Cortex M3
MCU

AN-6131API
5 Holt Integrated Circuits
Hardware Design Overview
Separate schematics and BOM’s documents are included on the Holt CD-ROM.
The detachable HI-6131 board can be separated from the provided MCU board for connection to a user-
supplied alternate microprocessor or FPGA board. The inter-board headers are located on 0.1” (2.54 mm)
grid for compatibility with generic prototyping boards. All host interface signals go through the inter-board
headers. Numerous HI-6131 configuration pins (and the Remote Terminal address setting pins) are
controlled by DIP switches on the upper HI-6131 board; these signals are not available on the inter-board
headers.
The lower ARM Cortex M3 board is based on the flash-programmable Atmel AT91SAM3U-EK
microprocessor. A 4-signal Serial Peripheral Interface (SPI) clocked at 16MHz (20MHz is possible) connects
to the HI-6131. A UART-based serial port provides RS-232 console I/O (optional). An uncommitted USB
2.0 port is available for future expansion. Two pushbuttons are available for software interaction. A RESET
pushbutton resets the ARM microprocessor, which in turn controls the HI-6131 Master Reset signal.
The ARM Cortex M3 board includes “J-Link On Board” debug interface, licensed from www.segger.com,
providing out-of-box readiness without having to buy a costly JTAG debug cable. The kit includes a simple
USB cable for connecting the board’s debug interface to your computer. (For users already owning an
ARM debug interface with ribbon-cable connector, an ARM-standard 2x10 debug connector provides
debug connectivity. In this case, jumper JP2 on the bottom of the lower board should be soldered closed
to disable “J-Link On Board”.)
The 64K serial EEPROM is not demonstrated on this kit. For information on the AUTO initialization feature
of the HI-6131 using the EPPROM see document AN-6131.pdf for the non Holt API version of the demo kit
software.
Holt API Host Memory Considerations
Holt API uses C malloc() functions to allocate memory from ARM Cortex M3 internal SRAM for API host
buffers. The total amount of SRAM available on the selected Atmel ARM Cortex M3 MCU is 48K bytes.
This SRAM is shared for all C code static, dynamic variables including the stack and heap. The 48K bytes
are adequate for the demonstrations in this software. User SRAM requirements depend on number of
enabled 1553 terminal modes and buffer size(s) needed for the application.
If more memory is required, choose a processor with more SRAM or augment the processor with external
SRAM. The Holt ADK-6130-2 board is an example that uses the same Atmel ARM Cortex M3 processor
with an additional 256K byte external SRAM memory. See AN-6130-2.pdf for this example. Note: The ADK-
6130-2 uses a Holt HI-6130 protocol IC with parallel bus interface (not SPI) and the SRAM memory
expansion also uses the MCU external bus interface.

AN-6131API
6 Holt Integrated Circuits
There are alternative MCUs with more internal SRAM. For example NXP offers “Kinetis” ARM Cortex M4
microcontrollers with up to 256K bytes internal SRAM. NXP offers the Kinetis ARM Cortex M4 in SPI-only
(as well as SPI and External Bus Interface) configuration. A SPI-only selection could replace the ARM Cortex
M3 on the board we are using here, with up to 256K bytes internal SRAM.
Initial Kit Set Up
The Application Development Kit is pre-programmed to concurrently operate as a Bus Controller, SMT
Bus Monitor and two independent Remote Terminals. Terminal addresses for the two RTs are preset using
DIP switches, before applying power. The two 6-position DIP switches should already be set with these
address values, plus odd parity. The RT1 DIP switches should be set to RT address 3 (0-0-0-1-1-parity 1),
RT2 should be set to RT address 1 (0-0-0-0-1-parity 0), to work with the demonstration program utilized
by the preprogrammed Bus Controller message repertoire. The two 6-position DIP switches should
already be set with these address values, plus odd parity and match the board photo on page 2. The user’s
guide, source code and software documentation sometimes refers RT1 as just RT.
1. The PC will need a serial (COM) port and a “terminal emulation” program like TeraTerm. Most
computers no longer have RS232 com ports so will require a serial-to-USB adapter, supplied with
the ADK. Connect this to the computers USB port and the 9 pin connector to the ADK board.
2. If using Windows 2000 or Windows XP, you can use HyperTerminal for terminal emulation. Open
HyperTerminal by clicking Start then All Programs; click the Windows Accessories then
Communications program group. Double-click HyperTerminal to run it. Skip the next paragraph.
If using Vista or Windows 7…
HyperTerminal is not included with these versions of Windows. Install the free open-source
terminal emulation program, TeraTerm 4.71, by running the provided teraterm-4.71.exe installer
program from the Holt CD. Accept the license agreement stating redistribution is permitted
provided that copyright notice is retained. The notice can be displayed from the TeraTerm window
by clicking Help then clicking About TeraTerm. Continuing to install…
Accept the default install destination and click Next.
At the Select Components screen, unselect all options except Additional Plug-in =
TTXResizeMenu and click Next.
Select the installed language, then click Next.
Accept the default Start Menu folder, then click Next.
Select any desired shortcuts, then click Next.
At the Ready to Install screen, click Install.

AN-6131API
7 Holt Integrated Circuits
Run the TeraTerm program. At the New Connection screen, select (x)Serial and choose the
selected COM port. Click Setup then Serial Port to open the serial port setup window. Choose
these settings: Baud Rate: 115200, Data: 8 bits, Parity: none, Stop: 1 bit, Flow Control: none.
3. After configuring the Console port, connect the DB-9 serial cable to the PC.
4. Do not connect the included USB debugger cable between the DEBUG port on the lower (MCU)
board and the PC until instructed to, later.
5. To observe bus activity, connect an oscilloscope to the red test points labeled BUS A and BUS B.
The test point labeled ACTIVE is a convenient scope trigger signal that goes high at start of
message and goes low at message completion.
6. If not connected by cable to actual MIL-STD-1553 buses, provide resistive dummy loads for buses
A and B by connecting a 75 Ω 1/2 Watt (or any value between 70-80 Ω) resistor across each pair
of red and black Bus test points. (For this demonstration, half-Watt resistors are adequate
because duty cycle is sufficiently low. When using the on-chip HI-6131 to generate BC messages
directed to on-chip RTs, use external 75 Ω resistor loads. When using a bus coupler to connect to
actual MIL-STD-1553 buses, do not use the 75 Ω dummy load resistors.
7. Set SW8 configuration DIP switches labeled AUTOEN and COPYREQ off (down position). These
switches are not used by this version of the demo program so they can be repurposed by the user.
8. Plug-in the provided 5V DC power supply and connect the cable to the power input jack on the
lower circuit board. If TeraTerm is running and configured correctly, the command menu below
should appear in the console window.
9. This menu appears and three green LEDs will flash momentarily whenever the board power is
applied, or when the RESET pushbutton is pressed. After verifying correct TeraTerm
communication with the evaluation board, the terminal set up can be saved by clicking Setup then
Save Setup.
The dates and times shown will differ from the screen captures shown below.

AN-6131API
8 Holt Integrated Circuits
Press ‘R’ or ‘r’ to display the HI-613x registers.

AN-6131API
9 Holt Integrated Circuits
General Structure of Demo Functions
The Holt API demonstration program is contained in module demos.c. The Holt API runtime library is
contained in the library file “HI-613x API LIB.a”as executable object code. File demos.c
contains the demo initialization API function calls supporting demonstrations executed from the console
menu to initialize the BC, RT,RT2 and monitor terminals. Key presses are detected in console.c
which is called from the main loop in main.c and executes demo functions in demos.c.
Commands ‘A’ and ‘N’ transmit BC commands can be viewed on an oscilloscope and optionally display
the message traffic data on the console using the ‘K’ and ‘T’ command sequence. These demos
demonstrate how Holt API’s are used to generate BC Asynchronous messages, Major/Minor frames, low
priority and high priority messages. View these messages with external MIL-STD-1553 test equipment or
view them with an oscilloscope.
This exercise uses the internal BC to transmit messages, so message traffic data is displayed on the
console. Since the internal BC, RTs and SMT share the same bus pins, the RT’s and SMT monitor
terminals receive the BC messages. If an external BC is already connected to the bus jack though a bus
coupler, it is okay to leave it connected, but disable any external BC transmissions that will conflict with
the on-chip BC transmissions.
For the following demonstrations all four terminals in the HI-6131 API demo program are enabled and
initialized by console commands.
BC and RT MT Mode.
This demonstrates BC, RT and MT all together and displays the traffic data on the console.
1. Press command ‘B’ to enable the RT.
2. Press command ‘K’ to enable the RTMT demo.
3. Press command ‘T’ (or spacebar) to display RT traffic on the console. Command ‘T’ toggles on
and off alternately to enable or disable the RT traffic shown on the console. Using the ‘T’
command relies on prior execution of command ‘K’.
4. Press command ‘A’ to start the BC transmitting messages.
Messages will display rapidly on the screen, Press the space bar to stop the console output. The
console should freeze and look similar to the screen below. Press space bar again to restart the
console output. Using the space bar does not stop BC transmission or prevent RT or MT message
reception; it only stops console output.

AN-6131API
10 Holt Integrated Circuits
Some of the BC commands are RT to RT. The BC commands to RT3 only shows no errors but RT
to RT commands to RT1 and RT3 will show “ ERROR: NORES” (no response) since there’s no RT
at address 1.
To see these same messages without the “ERROR:NORES” enable RT2 by pressing the ‘C’
command and repeat the messages. RT2 will now receive and acknowledge the messages to RT2
which is set to RT address 1 by DIP switches.
The Bus A green LED flashes rapidly (but appears continuously lit) with this demo.
5. BC Low Priority Asynchronous Message Insertion
Command ‘L’ inserts a low priority message into the scheduled BC message list. Low priority Inserted
messages occur upon completion of any BC minor frame in-process when insertion is requested.
First, enable the RT by pressing ‘B’ then Press ‘A’ to enable the BC transmission. Press ‘L’ to transmit
three extra messages on Bus B. Bus B is used to make it easier to see on the scope and the Bus B LED
should flash. If the RT is not enabled, retry messages appear on Bus B; this makes it difficult to see
the three inserted messages. This will only work once after a power up or RESET.
The screen shot of these three messages are shown below captured by a Ballard USB UA1133 tester.

AN-6131API
11 Holt Integrated Circuits
6. BC High Priority Asynchronous Message Insertion.
Follow the same steps as the previous BC low priority message example but this time Press ‘H’ to
insert a single high priority message. This command is repeatable and the Bus B LED will flash with
each command. Inserted High Priority messages occur upon completion of any in-process message
when insertion is requested.
7. Command ‘E’ Enumerate Card is reserved for future use.
8. From a RESET, if the BC is started before enabling the ‘K’ and ‘T’ sequence to display message
traffic, the first message may contain an error. This is normal; this occurs because the RT and MT
are enabled midstream of a message in progress.
9. The ‘N’ command transmits fifteen commands to RT address 3. Press ‘B’ to enable the RT.
Press ‘N’ to execute the BC transmissions (15 messages are transmitted) which will appear on the
bus as shown below. To optionally see the message traffic on the console, enable the RT message
traffic by pressing ‘T’ if it hasn’t already been enabled.

AN-6131API
12 Holt Integrated Circuits
Command ‘N’ (15 message) Traffic capture using a Ballard USB 1553 monitor.
When a BC message is transmitted to a RT that is not enabled, “RT no response” (NORES) error is
indicated.
MSG #0170. TIME = 00086918us BUS A TYPE2: RT to RT
CMD1 182A --> 03-R-01-10
CMD2 0C2A --> 01-T-01-10
ERROR: NORES

AN-6131API
13 Holt Integrated Circuits
RT Mode using external BC
Using an external BC tester (such as Ballard USB 1553) to transmit messages to the demo
board.
1. When an external BC is connected using conventional 1553 buses, use cables to connect the
demo board circular tri-axial bus jacks to bus coupler ports on the A and B bus networks. In this
case any external bus load 70 Ω resistors should be disconnected.
If bus couplers are not readily available, bench testing can be done by connecting external
dummy bus load 70 Ω resistors and connecting BC tester cables directly to the demo board tri-
axial jacks for buses A and B.
2. Press the RESET button and then Press ‘B’ to enable the RT (RT1) then Press ‘K’ and ‘T’ to
activate the RT traffic on the console. Compose a BC to RT message with SA=1 and 32 data
words similar to the message shown below using external BC tester equipment.
3. The console should show the message transmitted by the BC, after the transaction.
4. When transmitting repeating messages at a high rate typical of MIL-STD 1553, the RT Traffic
shown on the console may not keep pace due to limitations of the console 115,200 baud rate
and the prolific use of slow-to-execute printf function calls in the C program’s console user
interface. Depending on the message content and repetition rate, some messages may not show
on the console. All messages are transacted properly and captured by enabled RT and MT, some
messages simply will not be shown on the console.

AN-6131API
14 Holt Integrated Circuits
MT Mode
Press ‘S’ to enable SMT simple monitor. No other terminal is required; ‘S’ can be used after board reset.
A list of addresses shows the Command Stack and Data Stack buffer start address and end address. After
sending some messages to the monitor use this command to display the addresses and use the Memory
Watch window to view the Command and Data in memory. The SMT is also initialized with the ‘K’
command that provides message details. The ‘T’ RT Traffic feature toggles display of formatted RT
message data on the console. The data shown below is the default values after a board reset.
After one message transmitted by an external BC as shown will produce the following results.

AN-6131API
15 Holt Integrated Circuits
Getting Started with the Holt API demo software project and installing
IAR Systems Embedded Workbench for ARM Compiler
1. Installed IAR Systems Embedded Workbench for ARM (EWARM ) compiler is required BEFORE
adding the Holt demo projects, so all Atmel board library files and the demo project folder are
created in the proper location. Follow the “Holt HI-6131 API Demo Project Installation Guide”
found in the Project folder on the Holt CD-ROM. Before proceeding to the next steps IAR must
be installed and the two Holt project folders must be in the proper folder locations, according to
that guide. Instructions beyond this point assume you have completed the above installation
tasks.
2. Launch IAR Embedded Workbench from the Windows Start menu. A blank screen should appear.
Open the Holt HI-6131 API Demo Project from the IAR File pull-down menu, click on
File/Open/Workspace and navigate to the project folder location and select “HI-6131 API
Demo.eww” and click the Open button.
3. An IAR Workspace window should appear on the left side as shown below. If the Workspace
directory pane is missing, select “Workspace” from the View pull-down menu. Make any
window adjustments or open any of the folder groups to view included files to suit your
preferences.
4. Double click the main.c file, it should appear in the text editor pane, similar to the screen
capture shown on the next page.
5. The first time a project is unzipped and installed in the appropriated folder a Rebuild All should
be performed (from Project pull down menu).
6. IAR getting started, project management and other guides are available from the IAR
Workbench Help pull down menu.
Mode Holt Project Configurations
IAR project configurations are used to reconfigure the demo software using preprocessor macros.
Configurations are selectable from the Workspace pull-down menu using macros defined in the project
options C/C++ preprocessor tab. The three macros IAR, IAR_SPI_ENABLE and IAR_HI-6131_ENABLE
control which sections of code are compiled for the demo project. Other macros are used to enable BC,
RT or SMT sections of code. Holt uses a common code base for multiple projects. This means there are
functions not used in this project but are left in the C and H files. The IAR compiler uses the macros to
select sections of code to build and link. Some references to HI-6130 or HI-6138 MAMBA™ are to be
expected. In some cases some functions are simply not used or macros are used inside a function to select
appropriate code.

AN-6131API
16 Holt Integrated Circuits
Main Project demo screen (move and size the windows according to preference):

AN-6131API
17 Holt Integrated Circuits
The configuration list may vary slightly from the list shown.
Project configurations with “FULL” required the Holt API library source code. The API library source code
is not provided in the standard ADK. The full API source code is available with a signed Holt software
license agreement (SLA). The standard ADK demos are fully functional otherwise, and API projects can
be built without the API C source code. Contact Holt sales for the SLA for the optional API C source code.
The “FULL REGRESSION_TEST” is for Holt testing only and can be deleted by the user.
A simple way to create a new configuration is to select Project/Edit Configurations and then select New.
The dialog box will allow a new configuration based on an existing configuration with a new
configuration name. Select the new configuration and edit the preprocessor labels as desired then save
the new configuration. The new configuration will now appear in the pull down menu. Project file
613x_initialization.h configures other critical project settings, including the time tag
resolution and console I/O on-off.
The IAR embedded workspace provides may of the commonly used tasks as short-cut buttons on the top
as shown.
Stop
Debug
Toggle
Brkpoint
Restart
Debugger
Make
Reset
Break
Step
Into
Run to
Cursor
Go
Step
Over
Compile
IMPORTANT EMBEDDED WORKBENCH BUTTONS

AN-6131API
18 Holt Integrated Circuits
Project File List with Selected Descriptions
Most of the function names are self-explanatory, some functions retain the names from the original 6130-
2 or MAMBA™ (HI-6138) project they were written for, don’t worry about this they work fine with the HI-
6131 API demo.
device_SPI.h
Macro definitions for register addressing.
board_SPI.c, board_SPI.h
SPI configuration, SPI read/write and Memory watch functions. SPI frequency selection.
613x_initialization.h
Definitions for important configuration settings.
613x_Interrupts.h
Provides interrupt related prototypes for API use.
main.c
The primary program entry portal, main()demonstrates initialization sequence used of enabled
terminals. After initialization is complete, function calls demonstrate powerful addressing
methods for all RAM structures used by the enabled terminal modes. Demo initialization and
execution uses Holt high-level API in this demo kit.
board_613x.c, board_613x.h
Contains ARM MCU SPI i/o definitions and macro definitions for
SPI commands
SPIopcode(opcode) ;
Write_6131LowReg(reg_number, data, irq_mgmt) ;
Read_6131LowReg(reg_number, irq_mgmt) ;
Write_6131_1word(data, irq_mgmt) ;
Read_6131_1word(irq_mgmt) ;
Write_6131(write_data[], inc_pointer_first, irq_mgmt) ;
Read_6131(number_of_words, irq_mgmt) ;
Write_6131_Buffer(write_data[], inc_pointer_first, irq_mgmt) ;
Read_6131_Buffer(number_of_words, inc_pointer_first, irq_mgmt) ;
Read_Current_Control_Word(rt_num, irq_mgmt) ;
getMAPaddr() ;
enaMAP(map_num) ;
Read_Current_Control_Word(rt_num, irq_mgmt);
Read_RT1_Control_Word(txrx, samc, number, irq_mgmt);
Read_RT2_Control_Word(txrx, samc, number, irq_mgmt);
ReadWord_Adv4(irq_mgmt) ;

AN-6131API
19 Holt Integrated Circuits
Read_Last_Interrupt(irq_mgmt) ;
Fill_6131RAM_Offset() ;
Fill_6131RAM(addr, num_words, fill_value) ;
Memory_watch(address);
Configure_ARM_MCU_SPI();
Spi_register_write();
Spi_memory_write_ff();
Spi_memory_write_1fff();
board_613x.c
ConfigureGpio(); initializes ARM MCU general purpose I/O
reset_613x();
init_timer();
Delay_us(num_us);
Delay_ms(num_ms);
Delay_x100ms(num);
Flash_Red_LED();
Flash_Green_LED();
board_613x.h;
Contains ARM MCU i/o definitions controlled by macros. The SPI pins
are common between MAMBA™ and HI-6131 since both use a SPI
interface.
BC.h
BC.h has macros, C structures and prototypes for API use.
MT.h
MT.h has macros, C structures and prototypes for API use.
RT.h, RTMT.h
Has macros, C structures and prototypes for API use.
console.c
Console functions used by all terminal modes:
ConfigureUsart1();
Show_menu();
chk_key_input();
list_all_regs();
Console functions used by Bus Controller (BC) mode:
bcAsync();
MajorMinorframe();

AN-6131API
20 Holt Integrated Circuits
Console functions used by Remote Terminal RT:
RTDemo();
Rt_mt();
Console functions used by SMT or IMT bus monitor modes:
SMTDemo();
Primitive console functions that "printf" redundant char strings to reduce program size:
print_null(), print_sp1sp(),print_b1sp(), print_b0sp();
print_dddn(), print_dd0n(), print_dd1n();
print_menuprompt(), print_line();
Console function called by the Memory_watch() function
Manual SPI write utilities
ascii2int();
demos.c
Provides all demo functions that are called by the console menu.
DisplayDecodedMsg(); used to display 1553 formatted data to the
console when the ‘T’ command is used.
displayRTTraffic(); called from main; calls DisplayDecodedMsg()
board_lowlevel.c
This is an Atmel board file that changes the flash memory wait
states to 3WS.
Flash_MAMBA.icf - Project Linker File SAME one used for MAMBA™ for
this HI-6131 API demo project.
HI-613x API LIB.a –Precompiled Holt API library.
Holt API Library files
The standard API kit does not include the Holt API source files
although the API header files are included and grouped in the
workspace Holt_API/src sub-folder.
Other HOLT Microcontroller manuals