Page 1 of 1

Redirect Zigbee verbose to Usart

Posted: Fri Jan 06, 2012 2:25 pm
by Ondra
Good day all.
I have a zigbee project that does not employ an LCD screen. On selecting verbose, the AT commands that initialize the module are sent to the LCD if connected.
I would like to know if someone would be kind enough to give detailed outline on redirecting the AT commands to a second software and or hardware USART port.
I'm working 18LF46k80 which has 2 USART ports.

Thanks in advance
Ondra Simons

Re: Redirect Zigbee verbose to Usart

Posted: Fri Jan 06, 2012 6:22 pm
by Benj
Hello Ondra,

If you include a RS232 component in your program, configue the properties as you would like them and then include a random RS232 receive comp macro at the start of your program to ensure the component code is included into the code. Then compile to C and have a look at the generated C file and find the RS232 send function headers.

They should look something like this.
void FCD_RS2320_SendRS232Char(short nChar);
void FCD_RS2320_SendRS232String(char* String, char MSZ_String);

Maybe also physically test your RS232 here before continuing so you know bytes can be sent to the PC correctly using your settings.

Once you have done this right click the Zigbee component on the panel and select custom code.

Modify the following command.
Send_AT_Command

Look for this section of code.

Code: Select all

	if (LCD_VERB_ZIG == 1)
	{
		#if MX_ZIG_LCD == 1
			#ifdef MX_GFXLCD_PORT
				FCD_gLCD0_Clear();
				FCD_gLCD0_Print(String, 10, 2, 2, 2, 0);
			#else
				FCD_LCDDisplay0_Clear();
				FCD_LCDDisplay0_PrintString(String, 10);
			#endif
		#endif
	}
and change to the following where the function call matches your function header.

Code: Select all

	if (LCD_VERB_ZIG == 1)
	{
		FCD_RS2320_SendRS232String(String, 10);
	}
Then modify the following command.
Get_AT_Response

Look for this section of code. It is in this function twice.

Code: Select all

	if (LCD_VERB_ZIG == 1)
	{
		#if MX_ZIG_LCD == 1
			#ifdef MX_GFXLCD_PORT
				FCD_gLCD0_Print(String, 10, 2+(idx * 12), 20, 2, 0);
			#else
		  	  #ifdef MX_MIAC
				FCD_MIAC0_PrintASCII(temp);
			  #else
				FCD_LCDDisplay0_PrintASCII(temp);			//Output to LCD
			  #endif
			#endif
		#endif
	}
and change to the following where the function call matches your function header.

Code: Select all

	if (LCD_VERB_ZIG == 1)
	{
		FCD_RS2320_SendRS232Char(temp);
	}
Then the verbose information should be streamed through to the RS232 connection.