Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Function

    Lists the available BSP (<strong>B</strong>oard <strong>S</strong>upport <strong>P</strong>ackage) APIs.

Modules

 nm_bsp_init
 Initialize BSP.
 
 nm_bsp_deinit
 
 De-initialization for bsp (\e Board \e Support \e Package)

 
 nm_bsp_reset
 Reinitialization for bsp (Board Support Package) by resetting NMC1500 SoC by setting CHIP_EN and RESET_N signals low, CHIP_EN high then RESET_N high.
 
 nm_bsp_sleep
 Sleep in units of milliseconds.
 
 nm_bsp_register_isr
 Register ISR (Interrupt Service Routine) in the initialization of HIF (Host Interface) Layer.
 
 nm_bsp_interrupt_ctrl
 Synchrnonous enable/disable interrupts fucntion.
 
 nm_bsp_malloc
 Synchrnonous memory allocate API.
 
 nm_bsp_free
 Synchrnonous memory free API.
 

Functions

sint8 nm_bsp_deinit (void)
 De-iInitialize BSP. More...
 
sint8 nm_bsp_init (void)
 Initialization for bsp (Board Support Package) such as Reset and Chip Enable Pins for WILC, delays, register ISR, enable/disable IRQ for WILC, ...etc.
You must use this function in the head of your application to enable WILC and Host Driver communicate each other. More...
 
void nm_bsp_interrupt_ctrl (uint8 u8Enable)
 Enable/Disable interrupts. More...
 
void nm_bsp_register_isr (tpfNmBspIsr pfIsr)
 Register the host interface interrupt service routine. More...
 
void nm_bsp_reset (void)
 Reset NMC1500 SoC by setting CHIP_EN and RESET_N signals low, CHIP_EN high then RESET_N high. More...
 
void nm_bsp_sleep (uint32 u32TimeMsec)
 Used to put the host to sleep for the specified duration (in milliseconds). Forcing the host to sleep for extended period may lead to host not being able to respond to WINC board events. It is important to be considerate while choosing the sleep period. More...
 

sint8 nm_bsp_deinit ( void  )

De-iInitialize BSP.

This function is used to de-initialize the BSP and turn off the WINC board.

Precondition
Initialize nm_bsp_init first
Warning
Missing use may lead to unknown behavior in case of soft reset.
Note
Implementation of this function is host dependent.
See Also
nm_bsp_init
Returns
The function returns M2M_SUCCESS for successful operations and a negative value otherwise.
0 in case of success and -1 in case of failure
Author
M. Abdelmawla
Date
11 July 2012
Version
1.0
Returns
0 in case of success and -1 in case of failure

The nm_bsp_deinit is the last function that should be called after the application has finished and before the WINC is switched off. A call to this function will turn off the WINC board by setting CHIP_EN and RESET_N signals low. Every function call of nm_bsp_init should be matched with a call to nm_bsp_deinit. Failure to do so may result in the WINC consuming higher power than expected, since it won't be properly de-initialized.

Precondition
The BSP should be initialized through nm_bsp_init first.
Note
Implementation of this function is host dependent.
Warning
Omitting this function may lead to unknown behavior in case of soft reset.
See Also
nm_bsp_init
Returns
The function returns M2M_SUCCESS for successful operations and a negative value otherwise.
0 in case of success and -1 in case of failure
Version
1.0

References M2M_SUCCESS, and pio_set_pin_low().

sint8 nm_bsp_init ( void  )

Initialization for bsp (Board Support Package) such as Reset and Chip Enable Pins for WILC, delays, register ISR, enable/disable IRQ for WILC, ...etc.
You must use this function in the head of your application to enable WILC and Host Driver communicate each other.

This function is used to initialize the Board Support Package (BSP) in order to prepare the WINC before any WINC API calls.

Initialize BSP.

Warning
Missing use will lead to unavailability of host communication.
Note
Implementation of this function is host dependent.
Returns
The function returns M2M_SUCCESS for successful operations and a negative value otherwise.
0 in case of success and -1 in case of failure
Author
M. Abdelmawla
Date
11 July 2012
Version
1.0

The nm_bsp_init function is the first function that should be called at the beginning of every application to initialize the BSP and the WINC board. Otherwise, the rest of the BSP function calls will return with failure. This function should also be called after the WINC has been switched off with a successful call to nm_bsp_deinit in order to reinitialize the BSP before the Application can use any of the WINC APIs again. After the function initializes the WINC, a hard reset must be applied to start the WINC board by calling nm_bsp_reset.

Note
Implementation of this function is host dependent.
Warning
Omitting this function will lead to unavailability of host-chip communication.
See Also
nm_bsp_deinit, nm_bsp_reset
Returns
The function returns M2M_SUCCESS for successful operations and a negative value otherwise.
0 in case of success and -1 in case of failure
Version
1.0

References delay_init, gpfIsr, init_chip_pins(), nm_bsp_reset(), and NULL.

Referenced by main(), os_m2m_wifi_init_imp(), and serial_bridge().

void nm_bsp_interrupt_ctrl ( uint8  u8Enable)

Enable/Disable interrupts.

Enable/Disable interrupts from the WINC.

Parameters
[in]u8Enable'0' disable interrupts. '1' enable interrupts
See Also
tpfNmBspIsr
Note
Implementation of this function is host dependent and called by HIF layer.
Returns
None

This function can be used to enable/disable the WINC to host interrupts, depending on how the driver is implemented. It is an internal driver function and shouldn't be called by the application.

Parameters
[in]u8Enable
  • '0' disable interrupts.
  • '1' enable interrupts.
Precondition
The interrupt must be registered using nm_bsp_register_isr first.
Note
Implementation of this function is host dependent and called by HIF layer.
See Also
tpfNmBspIsr, nm_bsp_register_isr
Returns
None

References pio_disable_interrupt(), pio_enable_interrupt(), and pio_get_interrupt_status().

Referenced by hif_handle_isr(), hif_isr(), hif_set_rx_done(), and isr().

void nm_bsp_register_isr ( tpfNmBspIsr  pfIsr)

Register the host interface interrupt service routine.

Parameters
[in]pfIsrPointer to ISR handler in HIF
Warning
Make sure that ISR for IRQ pin for WILC is disabled by default in your implementation.
Note
Implementation of this function is host dependent and called by HIF layer.
See Also
tpfNmBspIsr
Returns
None

The WINC board uses the SPI interface to communicate with the host. This function registers the SPI interrupt to notify the host whenever there is an outstanding message from the WINC board. This function should be called during the initialization of the host interface. It is an internal driver function and shouldn't be called by the Application.

Parameters
[in]pfIsrPointer to ISR handler in the HIF layer.
Note
Implementation of this function is host dependent and called by HIF layer.
Warning
Make sure that ISR for IRQ pin for WINC is disabled by default in your implementation.
See Also
tpfNmBspIsr
Returns
None

References chip_isr(), gpfIsr, pio_configure_pin(), pio_enable_interrupt(), pio_get_interrupt_status(), PIO_IT_LOW_LEVEL, pio_pull_up(), PIO_PULLUP, PIO_TYPE_PIO_INPUT, and sysclk_enable_peripheral_clock().

Referenced by hif_init().

void nm_bsp_reset ( void  )

Reset NMC1500 SoC by setting CHIP_EN and RESET_N signals low, CHIP_EN high then RESET_N high.

Performs a hardware reset to the WINC board.

Parameters
[in]None
Precondition
Initialize nm_bsp_init first
Note
Implementation of this function is host dependent and called by HIF layer.
See Also
nm_bsp_init
Returns
None

The nm_bsp_reset is used to perform a hard reset on the WINC board by setting CHIP_EN and RESET_N signals low, then after an appropriate delay this function puts CHIP_EN high then RESET_N high, for more details on the timing between signals please check the WINC data-sheet. After a successful call, the WINC board firmware will kick off to load and start the WINC firmware. This function should be called to reset the WINC firmware after the BSP is initialized and before the start of any communication with WINC board. Calling this function at any other time will result in losing the state and connections saved in the WINC board and starting again from the initial state. The host driver will need to be de-initialized before calling nm_bsp_reset and initialized again, which can be achieved by use of m2m_wifi_init and m2m_wifi_deinit.

Precondition
Initialize the BSP first by calling nm_bsp_init.
Note
Implementation of this function is host dependent and called by HIF layer.
Warning
Calling this function will drop any connection and lose the internal state saved on the WINC firmware.
See Also
nm_bsp_init, m2m_wifi_init, m2m_wifi_deinit
Returns
None

References nm_bsp_sleep(), pio_set_pin_high(), and pio_set_pin_low().

Referenced by nm_bsp_init(), and nm_bus_init().

void nm_bsp_sleep ( uint32  u32TimeMsec)

Used to put the host to sleep for the specified duration (in milliseconds). Forcing the host to sleep for extended period may lead to host not being able to respond to WINC board events. It is important to be considerate while choosing the sleep period.

Parameters
[in]u32TimeMsecTime unit in milliseconds
Precondition
Initialize nm_bsp_init first
Warning
Maximum value must nor exceed 4294967295 milliseconds which is equal to 4294967.295 seconds.
Note
Implementation of this function is host dependent.
See Also
nm_bsp_init
Returns
None
Parameters
[in]u32TimeMsecTime unit in milliseconds.
Precondition
Initialize nm_bsp_init first.
Note
Implementation of this function is host dependent.
Warning
Maximum value must nor exceed 4294967295 milliseconds which is equal to 4294967.295 seconds.
See Also
nm_bsp_init
Returns
None

References delay_ms.

Referenced by app_ble_wifi_provisioning(), app_main(), chip_reset(), chip_wake(), cpu_start(), enable_disable_ap_mode(), enable_rf_blocks(), hif_deinit(), hif_send(), load_efuse_to_regs(), main(), nm_bsp_reset(), nm_bus_init(), nm_drv_init_hold(), socket_cb(), wait_for_bootrom(), wait_for_firmware_start(), write_to_efuse(), and WriteRootCertificate().