SUM1553 Bus Controller RT-to-RT Sample Application (SSK 1.x)
Overview
The SUM1553 BC RT-to-RT sample application shows how to configure an NAI Summit-based MIL-STD-1553 channel as a Bus Controller (BC) and use it to command an RT-to-RT transfer — a message in which one Remote Terminal (RT) transmits data directly to another RT over the bus, orchestrated by the BC.
A quick refresher on the roles in a 1553 bus, since the Summit API is organized around them:
- Bus Controller (BC) — the single master that initiates every transaction by issuing command words. This sample configures a channel as the BC.
- Remote Terminal (RT) — an addressed device that responds to the BC. In an RT-to-RT transfer, one RT is told to transmit and another to receive; the payload travels RT→RT on the bus without passing through the BC. The companion SUM1553 RT PingPong and SUM1553 RT ProcCtrl samples can play the RT side.
- Bus Monitor (BM) — a passive listener (not used here).
The Summit BC works from a command list in the channel’s block memory. Each entry is a command block carrying a control word (an opcode plus options), up to two 1553 command words, and a pointer to a data block. The BC executes the list from a starting block pointer until it hits an end-of-list entry. This sample builds a two-entry list — one RT-to-RT message followed by an end-of-list marker — and re-runs it each time you ask.
Note
“Summit” refers to the 1553 protocol engine on NAI’s FT-series modules (the N7/N8 variants). The sample uses the
naibrd_SUM1553_*()API; a separate, ACE-basednaibrd_1553_*()API exists for other 1553 modules.
Prerequisites
Before running this sample, make sure you have:
- An NAI board with a Summit-capable FT 1553 module (FTA–FTF, FTJ–FTK).
- Two Remote Terminals on the same bus at the addresses this sample targets (RT 1 and RT 2). These can be provided by the companion SUM1553 RT sample apps running on other channels or boards.
- SSK 1.x installed on your development host, with the sample applications built.
How to Run
Launch the SUM1553_BC_RTtoRT executable from your build output directory. On startup the application looks for a configuration file (default_SUM1553_BCRTtoRT.txt). On the first run this file will not exist — the application presents an interactive board menu where you configure a board connection, card index, and module slot. After selecting the module you choose the BC channel; the sample then lets you send RT-to-RT messages in either direction until you quit.
Board Connection and Module Selection
Note
This startup sequence is common to all NAI sample applications. The board connection and module selection code shown here is not specific to 1553.
The main() function follows the standard SSK 1.x startup flow — naiapp_RunBoardMenu(), then naiapp_query_CardIndex(), naibrd_GetModuleCount(), naiapp_query_ModuleNumber(), and naibrd_GetModuleID() — handing a valid module to Run_SUM1553_BC_RTtoRT().
Important
Common connection errors you may encounter at this stage:
- No board found / connection timeout — verify the board is powered and connected; check
default_SUM1553_BCRTtoRT.txtor reconfigure in the board menu.- Invalid card or module index — indices are zero-based for cards and one-based for modules.
- “Module selected does not support Summit 1553 Functionality” — the selected module is not a Summit (FT) 1553 module; the channel-setup helper rejects it.
Configuring the Channel as a Bus Controller
Run_SUM1553_BC_RTtoRT() first asks which channel to use with the shared Get1553BCCfg() helper (a Summit FT module exposes two 1553 channels), then resets the channel and waits for the reset to complete before configuring it:
bQuit = Get1553BCCfg(modid, DEF_BC_CHANNEL, &bcchan);
if (!bQuit)
{
/* Reset the channel and wait for it to finish */
naibrd_SUM1553_Reset(cardIndex, module, bcchan);
while (naibrd_SUM1553_IsResetting(cardIndex, module, bcchan, &resetting) == NAI_SUCCESS && resetting);
/* Configure the channel as a Bus Controller */
naibrd_SUM1553_SetMode(cardIndex, module, bcchan, NAI_SUM1553_OPSTATUS_BC_MODE);
/* Point the BC at the first command block */
naibrd_SUM1553_BC_SetCmdBlockPtr(cardIndex, module, bcchan, FIRST_CMD);
...
}nai_status_t naibrd_SUM1553_Reset(int32_t cardIndex, int32_t module, int32_t channel)— resets the 1553 channel to a known state.nai_status_t naibrd_SUM1553_IsResetting(int32_t cardIndex, int32_t module, int32_t channel, bool_t* outresetting)— reports whether the channel is still resetting. Always wait for this to clear before configuring the channel.nai_status_t naibrd_SUM1553_SetMode(int32_t cardIndex, int32_t module, int32_t channel, nai_sum1553_opstatus_t mode)— sets the channel’s operating mode.NAI_SUM1553_OPSTATUS_BC_MODEselects Bus Controller;NAI_SUM1553_OPSTATUS_RT_MODEselects Remote Terminal.nai_status_t naibrd_SUM1553_BC_SetCmdBlockPtr(int32_t cardIndex, int32_t module, int32_t channel, uint32_t blockIndex)— sets the index of the command block the BC will execute next.FIRST_CMD(0) starts at the top of the list.
Building the RT-to-RT Message
The message is defined by loading a command block and its data block. The command block is assembled from a control word and two 1553 command words using the Summit bit-field macros:
uint16_t ctrl, cmd1, cmd2;
/* Control word: execute-block-and-continue, 1 retry, bus A, RT-to-RT flag set */
ctrl = NAI_SUM1553_BC_CTRL_WORD(NAI_SUM1553_OPCODE_EXEBLK_CONT, 1, 1, 1, 0);
/* cmd1 = RECEIVE command to RT1 (T/R bit = 0); cmd2 = TRANSMIT command from RT2 (T/R bit = 1) */
cmd1 = NAI_SUM1553_COMMAND_WORD(rt1addr, 0, rt1subaddr, wordcnt);
cmd2 = NAI_SUM1553_COMMAND_WORD(rt2addr, 1, rt2subaddr, wordcnt);
naibrd_SUM1553_BC_LoadCmdBlock(cardIndex, module, bcchan, ncmd++, ctrl, cmd1, cmd2, BLOCKC, 0, 0);
/* Load an associated data block */
for (i = 0; i < wordcnt; i++)
datablock[BLOCKC][i] = (uint16_t)(0xC000 + i);
naibrd_SUM1553_BC_LoadDataBlock(cardIndex, module, bcchan, BLOCKC, datablock[BLOCKC]);NAI_SUM1553_BC_CTRL_WORD(opcode, retries, busa, rtrt, cond)— builds a BC control word. Here the opcode isNAI_SUM1553_OPCODE_EXEBLK_CONT(execute this block, then continue to the next), with one retry, bus A selected, and thertrtflag set to 1 to mark this as an RT-to-RT transfer.NAI_SUM1553_COMMAND_WORD(rt, tx, sa, wcmc)— builds a 1553 command word from an RT address, the transmit/receive bit (tx: 1 = transmit, 0 = receive), a subaddress, and a word count (or mode code). For an RT-to-RT transfer the receive command (cmd1) names the destination RT and the transmit command (cmd2) names the source RT.nai_status_t naibrd_SUM1553_BC_LoadCmdBlock(int32_t cardIndex, int32_t module, int32_t channel, uint32_t blockIndex, uint16_t ctrl, uint16_t cmd1, uint16_t cmd2, uint16_t datablock, uint16_t branchblock, uint32_t timerus)— writes a command block atblockIndex, tying the control word, the two command words, and a data-block pointer together.nai_status_t naibrd_SUM1553_BC_LoadDataBlock(int32_t cardIndex, int32_t module, int32_t channel, uint32_t blockIndex, const uint16_t datablock[32])— loads 32 words into a data block in the channel’s block memory.
Note
In a true RT-to-RT transfer the payload on the bus is sourced by the transmitting RT (RT2), not by the BC. The BC’s job is to issue the receive and transmit command words in sequence; the sample loads a data block as well, but the on-bus data originates from the transmitting RT.
A second command block marks the end of the list so the BC stops after the message:
/* End-of-list entry */
ctrl = NAI_SUM1553_BC_CTRL_WORD(NAI_SUM1553_OPCODE_ENDOFLIST, 1, 1, 0, 0);
naibrd_SUM1553_BC_LoadCmdBlock(cardIndex, module, bcchan, ncmd++, ctrl, 0, 0, 0, 0, 0);The NAI_SUM1553_OPCODE_ENDOFLIST opcode tells the BC to stop executing when it reaches this block.
Running the Bus Controller
With the two-block list in place, the BC is pointed back at the first block and execution is enabled:
naibrd_SUM1553_BC_SetCmdBlockPtr(cardIndex, module, bcchan, FIRST_CMD);
naibrd_SUM1553_EnableExecution(cardIndex, module, bcchan, 1); /* run the BC */nai_status_t naibrd_SUM1553_EnableExecution(int32_t cardIndex, int32_t module, int32_t channel, bool_t enabled)— starts (1) or stops (0) execution of the channel’s command list.
Each time you press Enter the sample rebuilds and re-runs the list, sending another message; on quit it disables execution:
naibrd_SUM1553_EnableExecution(cardIndex, module, bcchan, 0); /* stop the BC */Choosing the Message Direction
The sample menu offers the same RT-to-RT message in two directions, simply by swapping which RT address/subaddress is the receiver and which is the transmitter:
- Option 1 — RT 1 receives (subaddress 2), RT 2 transmits (subaddress 2).
- Option 2 — RT 2 receives (subaddress 2), RT 1 transmits (subaddress 2).
Both build the identical command-block structure; only the rt1addr/rt2addr (and their subaddresses) fed into NAI_SUM1553_COMMAND_WORD() change.
Troubleshooting Reference
This table summarizes common errors and symptoms covered above. Consult your module’s manual for hardware-specific diagnostics.
| Error / Symptom | Possible Causes | Suggested Resolution |
|---|---|---|
| No board found or connection timeout | Board not powered, incorrect or missing config file, network issue | Verify hardware; check default_SUM1553_BCRTtoRT.txt or reconfigure in the board menu. |
| ”Module selected does not support Summit 1553 Functionality” | Selected module is not a Summit (FT) 1553 module | Choose an FT 1553 module (FTA–FTF, FTJ–FTK). |
| Message sent but no RT responds | No RT at the targeted address/subaddress, or the RT is not enabled on the bus | Bring up the receiving and transmitting RTs (e.g. the companion RT sample apps) at RT addresses 1 and 2 before sending. |
| Channel behaves erratically after startup | Configured before reset completed | Wait for naibrd_SUM1553_IsResetting() to clear before calling SetMode() or loading blocks. |
| BC runs past the intended message | Missing or misplaced end-of-list entry | Ensure an NAI_SUM1553_OPCODE_ENDOFLIST command block terminates the list. |
Full Source
The complete source for this sample is provided below for reference. The sections above explain each part in detail.
Full Source — SUM1553_BC_RTtoRT.c (SSK 1.x)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
/* Common Sample Program include files */
#include "include/naiapp_boardaccess_menu.h"
#include "include/naiapp_boardaccess_query.h"
#include "include/naiapp_boardaccess_access.h"
#include "include/naiapp_boardaccess_display.h"
#include "include/naiapp_boardaccess_utils.h"
/* Common 1553 Sample Program include files */
#include "nai_1553_utils.h"
/* naibrd include files */
#include "nai.h"
#include "naibrd.h"
#include "functions/naibrd_sum1553.h"
static const int8_t *CONFIG_FILE = (int8_t *)"default_SUM1553_BCRTtoRT.txt";
/* Function prototypes */
static bool_t Run_SUM1553_BC_RTtoRT(int32_t cardIndex, int32_t module, uint32_t modid);
static const int32_t DEF_BC_CHANNEL = 1;
static const uint8_t DEF_RT_ADDR1 = 1;
static const uint8_t DEF_RT_ADDR2 = 2;
static const uint8_t DEF_RT_SUBADDR1 = 2;
static const uint8_t DEF_RT_SUBADDR2 = 2;
static const uint16_t BLOCKC = 2;
static uint16_t datablock[3][32];
/**************************************************************************************************************/
/**
<summary>
The purpose of the SUM1553_BC_RTtoRT is to illustrate the methods to call in the naibrd library to send an RT-to-RT
message.
The following system configuration routines from the nai_sys_cfg.c file are called to assist with the configuration
setup for this program prior to calling the naibrd 1553 routines.
- ConfigDevice
- DisplayDeviceCfg
- GetBoardSNModCfg
- CheckModule
Note, the SUM1553_BC_RTtoRT can run in conjunction with the SUM1553_RT_PingPong or SUM1553_RT_ProcCtrl
applications to illustrate BC and RT operations together with the NAI 1553 module.
</summary>
*/
/**************************************************************************************************************/
#if defined (__VXWORKS__)
int32_t SUM1553_BC_RTtoRT(void)
#else
int32_t main(void)
#endif
{
bool_t stop = FALSE;
int32_t cardIndex;
int32_t moduleCnt;
int32_t module;
uint32_t moduleID = 0;
int8_t inputBuffer[80];
int32_t inputResponseCnt;
if (naiapp_RunBoardMenu(CONFIG_FILE) == TRUE)
{
while (stop != TRUE)
{
/* Query the user for the card index */
stop = naiapp_query_CardIndex(naiapp_GetBoardCnt(), 0, &cardIndex);
if (stop != TRUE)
{
check_status(naibrd_GetModuleCount(cardIndex, &moduleCnt));
/* Query the user for the module number */
stop = naiapp_query_ModuleNumber(moduleCnt, 1, &module);
if (stop != TRUE)
{
moduleID = naibrd_GetModuleID(cardIndex, module);
if ((moduleID != 0))
{
Run_SUM1553_BC_RTtoRT(cardIndex, module, moduleID);
}
}
}
printf("\nType Q to quit or Enter key to restart application:\n");
stop = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
}
}
printf("\nType the Enter key to exit the program: ");
naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
naiapp_access_CloseAllOpenCards();
return 0;
}
/**************************************************************************************************************/
/**
<summary>
Run_SUM1553_BC_RTtoRT queries the user for the module and channel to configure as the Bus Controller (BC).
After getting the module/channel selection, methods in the naibrd library are invoked to setup this channel
as a BC with either of the following 1553 messages:
1) RT-RT message with 32 words of data for which the Rx command is to the "DEF_RT_ADDR1" RT Address and
"DEF_RT_SUBADDR1" Subaddress and the Tx command is to the "DEF_RT_ADDR2" RT Address and "DEF_RT_SUBADDR2"
Subaddress
2) RT-RT message with 32 words of data for which the Rx command is to the "DEF_RT_ADDR2" RT Address and
"DEF_RT_SUBADDR2" Subaddress and the Tx command is to the "DEF_RT_ADDR1" RT Address and "DEF_RT_SUBADDR1"
Subaddress
Once the BC is configured and running, the user can:
1) Type the Enter key to send another RT-to-RT message.
3) Type 'Q' to quit stop the BC execution and exit the routine.
</summary>
*/
/**************************************************************************************************************/
static bool_t Run_SUM1553_BC_RTtoRT(int32_t cardIndex, int32_t module, uint32_t modid)
{
bool_t bQuit;
bool_t bContinue = TRUE;
int32_t bcchan = 2;
const uint16_t FIRST_CMD = 0;
bool_t resetting;
uint32_t ncmd = 0;
int32_t wordcnt = 32;
uint8_t rt1addr = DEF_RT_ADDR1;
uint8_t rt2addr = DEF_RT_ADDR2;
uint8_t rt1subaddr = DEF_RT_SUBADDR1;
uint8_t rt2subaddr = DEF_RT_SUBADDR2;
uint16_t ctrl;
uint16_t cmd1, cmd2;
uint16_t datablocknum;
uint16_t branchblock;
uint32_t timerus;
int32_t i;
int8_t inputBuffer[80];
int32_t inputResponseCnt;
bQuit = Get1553BCCfg(modid, DEF_BC_CHANNEL, &bcchan);
if (!bQuit)
{
/* Reset the channel */
check_status(naibrd_SUM1553_Reset(cardIndex,module,bcchan));
/* Wait for channels to reset */
while(check_status(naibrd_SUM1553_IsResetting(cardIndex,module,bcchan,&resetting)) == NAI_SUCCESS && resetting);
/* Setup the BC */
check_status(naibrd_SUM1553_SetMode(cardIndex,module,bcchan,NAI_SUM1553_OPSTATUS_BC_MODE)); /* Configure as BC */
/* Start with the first command */
check_status(naibrd_SUM1553_BC_SetCmdBlockPtr(cardIndex,module,bcchan,FIRST_CMD));
while (bContinue)
{
printf("\n1) Rx: RT Addr %d, SA %d; Tx: RT Addr %d, SA %d\n", DEF_RT_ADDR1, DEF_RT_SUBADDR1, DEF_RT_ADDR2, DEF_RT_SUBADDR2);
printf("2) Rx: RT Addr %d, SA %d; Tx: RT Addr %d, SA %d\n", DEF_RT_ADDR2, DEF_RT_SUBADDR2, DEF_RT_ADDR1, DEF_RT_SUBADDR1);
printf("\nSelect a number to send another RT-to-RT message or %c to quit: ", NAI_QUIT_CHAR);
bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
if (!bQuit)
{
if (inputBuffer[0] == '1')
{
rt1addr = DEF_RT_ADDR1;
rt1subaddr = DEF_RT_SUBADDR1;
rt2addr = DEF_RT_ADDR2;
rt2subaddr = DEF_RT_SUBADDR2;
}
else if (inputBuffer[0] == '2')
{
rt1addr = DEF_RT_ADDR2;
rt1subaddr = DEF_RT_SUBADDR2;
rt2addr = DEF_RT_ADDR1;
rt2subaddr = DEF_RT_SUBADDR1;
}
else
{
printf("\nInvalid value.\n");
continue;
}
/* First command block */
ncmd = FIRST_CMD;
/* RTRT Message with 32 words to RT SubAddress */
wordcnt = 32;
ctrl = NAI_SUM1553_BC_CTRL_WORD(NAI_SUM1553_OPCODE_EXEBLK_CONT,1,1,1,0);
cmd1 = NAI_SUM1553_COMMAND_WORD(rt1addr,0,rt1subaddr,wordcnt);
cmd2 = NAI_SUM1553_COMMAND_WORD(rt2addr,1,rt2subaddr,wordcnt);
datablocknum = BLOCKC;
branchblock = 0;
timerus = 0;
check_status(naibrd_SUM1553_BC_LoadCmdBlock(cardIndex,module,bcchan,ncmd++,ctrl,cmd1,cmd2,datablocknum,branchblock,timerus));
for (i = 0; i < wordcnt; i++)
datablock[BLOCKC][i] = (uint16_t)(0xC000 + i);
check_status(naibrd_SUM1553_BC_LoadDataBlock(cardIndex,module,bcchan,BLOCKC,datablock[BLOCKC]));
/* Load EOL */
ctrl = NAI_SUM1553_BC_CTRL_WORD(NAI_SUM1553_OPCODE_ENDOFLIST,1,1,0,0);
cmd1 = 0;
cmd2 = 0;
datablocknum = 0;
branchblock = 0;
timerus = 0;
check_status(naibrd_SUM1553_BC_LoadCmdBlock(cardIndex,module,bcchan,ncmd++,ctrl,cmd1,cmd2,datablocknum,branchblock,timerus));
/* Start with the first command */
check_status(naibrd_SUM1553_BC_SetCmdBlockPtr(cardIndex,module,bcchan,FIRST_CMD));
/* Run the BC */
check_status(naibrd_SUM1553_EnableExecution(cardIndex,module,bcchan,1));
}
else
bContinue = FALSE;
}
/* Disable the BC */
check_status(naibrd_SUM1553_EnableExecution(cardIndex,module,bcchan,0));
}
return bQuit;
}