5.9.6 Built in Automated Test Equipment (ATE) Mechanism
A factory flashed ATWINC15x0 module running the v19.6.1 firmware has a special ATE firmware in the Flash space reserved for OTA transfers (which is overwritten by the first OTA update).
A host API can be called during WINC initialization that causes the device to boot into
this special firmware (m2m_ate_init
). The API to control the ATE
functions provided by this firmware is detailed in
\ASF\common\components\wifi\winc1500\driver\include\m2m_ate_mode.h
.
The following is the sample code.
int main(void)
{
/* Initialize the board. */
system_init();
/* Initialize the UART console. */
configure_console();
printf(STRING_HEADER);
/* Initialize the BSP. */
nm_bsp_init();
/*Check if initialization of ATE firmware is succeeded or not*/
if(M2M_SUCCESS == m2m_ate_init())
{
/*Run TX test case if defined*/
#if (M2M_ATE_RUN_TX_TEST_CASE == ENABLE)
start_tx_test(M2M_ATE_TX_RATE_1_Mbps_INDEX);
#endif
/*Run RX test case if defined*/
#if (M2M_ATE_RUN_RX_TEST_CASE == ENABLE)
start_rx_test();
#endif
/*De-Initialization of ATE firmware test mode*/
m2m_ate_deinit();
}
else
{
M2M_ERR("Failed to initialize ATE firmware.\r\n");
while(1);
}
#if ((M2M_ATE_RUN_RX_TEST_CASE == ENABLE) && (M2M_ATE_RUN_TX_TEST_CASE == ENABLE))
M2M_INFO("Test cases have been finished.\r\n");
#else
M2M_INFO("Test case has been finished.\r\n");
#endif
while(1);
}
#if (M2M_ATE_RUN_TX_TEST_CASE == ENABLE)
static void start_tx_test(uint8_t tx_rate)
{
tstrM2mAteTx tx_struct;
/*Initialize parameter structure*/
m2m_memset((uint8 *)&tx_struct, 0 , sizeof(tx_struct));
/*Set TX Configuration parameters,
*refer to tstrM2mAteTx for more information about parameters*/
tx_struct.channel_num = M2M_ATE_CHANNEL_11;
tx_struct.data_rate = m2m_ate_get_tx_rate(tx_rate);
tx_struct.dpd_ctrl = M2M_ATE_TX_DPD_DYNAMIC;
tx_struct.duty_cycle = M2M_ATE_TX_DUTY_1;
tx_struct.frame_len = 1024;
tx_struct.num_frames = 0;
tx_struct.phy_burst_tx = M2M_ATE_TX_SRC_MAC;
tx_struct.tx_gain_sel = M2M_ATE_TX_GAIN_DYNAMIC;
tx_struct.use_pmu = M2M_ATE_PMU_DISBLE;
tx_struct.cw_tx = M2M_ATE_TX_MODE_CW;
tx_struct.xo_offset_x1000 = 0;
/*Start TX Case*/
if(M2M_ATE_SUCCESS == m2m_ate_start_tx(&tx_struct))
{
uint32 u32TxTimeout = M2M_ATE_TEST_DURATION_IN_SEC;
M2M_INFO(">>Running TX Test case on CH<%02u>.\r\n", tx_struct.channel_num);
do
{
nm_bsp_sleep(1000);
printf("%02u\r", (unsigned int)u32TxTimeout);
}while(--u32TxTimeout);
if(M2M_ATE_SUCCESS == m2m_ate_stop_tx())
{
M2M_INFO("Completed TX Test successfully.\r\n");
}
}
else
{
M2M_INFO("Failed to start TX Test case.\r\n");
}
}
#endif
#if (M2M_ATE_RUN_RX_TEST_CASE == ENABLE)
static void start_rx_test(void)
{
tstrM2mAteRx rx_struct;
/*Initialize parameter structure*/
m2m_memset((uint8 *)&rx_struct, 0, sizeof(rx_struct));
/*Set RX Configuration parameters*/
rx_struct.channel_num = M2M_ATE_CHANNEL_6;
rx_struct.use_pmu = M2M_ATE_PMU_DISBLE;
rx_struct.xo_offset_x1000 = 0;
/*Start RX Case*/
if(M2M_ATE_SUCCESS == m2m_ate_start_rx(&rx_struct))
{
tstrM2mAteRxStatus rx_data;
uint32 u32RxTimeout = M2M_ATE_TEST_DURATION_IN_SEC;
M2M_INFO(">>Running RX Test case on CH<%02u>.\r\n", rx_struct.channel_num);
do
{
m2m_ate_read_rx_status(&rx_data);
M2M_INFO("Num Rx PKTs: %d, Num ERR PKTs: %d, PER: %1.3f", (int)rx_data.num_rx_pkts, (int)rx_data.num_err_pkts,
(rx_data.num_rx_pkts>0)?((double)rx_data.num_err_pkts/(double)rx_data.num_rx_pkts):(0));
nm_bsp_sleep(1000);
}while(--u32RxTimeout);
printf("\r\n");
if(M2M_ATE_SUCCESS == m2m_ate_stop_rx())
{
M2M_INFO("Compeleted RX Test successfully.\r\n");
}
}
else
{
M2M_INFO("Failed to start RX Test case.\r\n");
}
}
#endif