Configuring Interface Lines

Top  Previous  Next

The GA1000 add-on interacts with your BASIC/C-programmable device through an SPI interface. The SPI interface has four signals: chip select (CS), clock (CLK), data in (DI), and data out (DO). On the EM500, DI and DO are combined together (this saves one GPIO line on a module that has very few of them). Connecting GA1000 shows related schematic diagrams.

All Tibbo devices except the EM500 allow remapping of SPI lines. That is, any four GPIO lines of your device can be chosen to control the GA1000. Wln.csmap, wln.clkmap, wln.dimap, and wln.domap properties exist for the purpose. There is no remapping on the EM500 and manipulating these properties makes no difference for it.

The GA1000 also has a reset (RST) line. As Connecting GA1000 explains, the RST line can be driven by a dedicated GPIO line of your device, or through a "joint effort" of CLK and DO, which, again, spares one GPIO pin of your device. There isn't any property to remap the RST line. This is because the RST is supposed to be controlled by your application directly. It exists outside of the wln. object's realm, so choose any GPIO to control it.

This said, some Tibbo hardware has all the choices made for you already. We are talking about the NB1000 board (part of DS100x) and the EM1206EV board. On these boards, all the necessary hardware connections to the GA1000 are already there, so your mapping just has to follow them. With the exception of the EM500, you have a complete freedom to map any way you want on all other devices, but why would you? We recommend you to follow this scheme:

 

 

#If PLATFORM_ID=EM500W

 #define WLN_RESET_MODE 1 'reset is controlled by the combination of CS and CLK

 'there is no need to map CS, DI, DO, and CLK lines because they are fixed

#elif PLATFORM_ID=EM1206W or PLATFORM_ID=DS1101W or PLATFORM_ID=DS1102W 'also applies to EM1206EV board

 #define WLN_RESET_MODE 0 'there is a dedicated reset line

 #define WLN_RST PL_IO_NUM_11

 #define WLN_CS PL_IO_NUM_15

 #define WLN_DI PL_IO_NUM_12

 #define WLN_Do PL_IO_NUM_13

 #define WLN_CLK PL_IO_NUM_14

#Else 'for all other devices including NB1010

 #define WLN_RESET_MODE 0 'there is a dedicated reset line

 #define WLN_RST PL_IO_NUM_51

 #define WLN_CS PL_IO_NUM_49

 #define WLN_DI PL_IO_NUM_52

 #define WLN_Do PL_IO_NUM_50

 #define WLN_CLK PL_IO_NUM_53

#endif

 

 

The above sets three schemes: one for the EM500 module and related devices, the second one for the EM1206, DS1101, DS1102, and related devices, and the third one for all other devices including the EM1000, EM1202, etc.

Here is the code snippet that prepares GPIO lines:

 

 

 '----- configure interface lines -----

 '(on platforms with fixed mapping this will have no effect and do no harm)

 wln.csmap=WLN_CS

 io.num=WLN_CS

 io.enabled=YES

 wln.dimap=WLN_DI

 wln.domap=WLN_DO

 io.num=WLN_DO

 io.enabled=YES

 wln.clkmap=WLN_CLK

 io.num=WLN_CLK

 io.enabled=YES

 io.num=WLN_RST

 io.enabled=YES

 

 

Note that mapping can't be changed when the Wi-Fi hardware is already booted (i.e. wln.enabled= 1- YES).