No response to AT command

Hi,

I uploaded App32Transparent application but after some time device stopped responding to AT commands.
“+++” works, “ATCN” works, but after ATID I’ve got “~…IDi” and with Show Api Off there is nothing on the UART after sending command.

I’ve uploaded program once again but it didn’t helped. What can be the problem?

I believe it is because earlier I sent ATBD2 what caused instat change of baudrate. Where in the code is a place where I can turn off appliing changed until ATAC is sent?

The App32Transparent kicks back both what is sent to the Radio “~…IDi” and what the radio responds with. “~…ID…a”.

Did you try to change Baud rates? (ATBD)
If so, that is the problem. ATBD needs to be 7.
Turn Power Off and back on. that should reset it as long as ATWR wasn’t sent.

If ATWR was sent.
Use the App32Transparent Bypass mode.
“+++”
“exit”
“c” --Enter custom ByPass Mode
This makes the Reset button reset the Radio rather than the secondary processor.

Use XCTU
“Modem Configuration” Tab
Select Baud Rate of 115200 (this can be changed depending on what you set it to.
Click “Read”
If the window pops up asking for a reset, use the reset button.
Set the baud rate to 7 - 115200
Click “Write”

Turn Power Off
Turn Power On again.
Should be back to normal.

The baud rate of the secondary processor is hard coded.
Unfortunately, it must be changed in the App code in order to change the baud rate.

The secondary processor and the Radio link should be left at 115200.
Why add delay to the communication between the secondary processor and the Radio.
The link between the Computer and the Secondary processor can be changed.

So how can the Computer change secondary procesor baud? I need something similar to ATBD.

The App is just a demo.
You must recompile to change the baud rate.

void InitHostUART(void) sets the baud rate.
You can change the setting of the SCI1BD = UART_BAUD_9600 (serial.c)
or create your own new define
Defines are in System.h
#define UART_BAUD_9600 (BUS_FREQ/16)/9600+.5
#define UART_BAUD_19200 (BUS_FREQ/16)/19200+.5
#define UART_BAUD_38400 (BUS_FREQ/16)/38400+.5
#define UART_BAUD_115200 (BUS_FREQ/16)/115200+.5

If you need the baud rate to be changeable at runtime, that can also be coded. But you must do it. You can change the code in the function ProcessCommand(void) (main.c)

OK, but as far as I can see the second UART is set to 9600:

void InitRadioUART(void){
/* configure SCI2/Radio UART mode */

SCI2BD = UART_BAUD_9600;

}

Why is that? I suppose I can’t just change it to:

SCI2BD = UART_BAUD_115200;

I’ve got another more urgent question. I’m using RS485 as communication interface with Xbee module. I’ve got direction pin connected to CTS (XBee pin 9) as described in manual. How can I enable RS485 using programmable module?

The reason I’m considering using this vesrion is that I’ve got application processor with no need of redesigning the board so the best option is that direction pin stays in the same place.

correct. Just change it to SCI2BD = UART_BAUD_115200;

Using a 485 conversion chip, the chip needs to know when to transmit.
CTS can be used for controlling that. You will need to write the code in order to operate it.
Toggle the CTS line High when transmitting.(if the chip is high enabled)
and then Toggling CTS low when the transmission completes.
you will need to look up the register that contains the flag for when the transmission is completed in the Freescale MC9S08QE32RM.pdf User manual.

If you are using 485 2 wire, you might need to cancel all bytes coming back through the RX serial port. often 485 chips don’t stop the receiver when in 2 wire mode.

Thank you. You really helped me, but I’ve got another problem. I cannot acces bootloader to upgrade firmware.

First I type “+++” to enter command mode.
Then “EXIT” to enter special menu.
Then after typing “A” nothing happens.

The same got for “B”.
“C” and other works.

Could I damaged something with my firmware changes?
Is there another way to acces bootloader?
I haven’t changes special menu function much:

void SpecialMenu(void){
char RxCharHost,exitMenu;

exitMenu = 0;
AppResetCause = 0;
while(!exitMenu)
{
WriteToHostUART(“\rMENU:”);
WriteToHostUART(“\rA to enter Bootloader”);
WriteToHostUART(“\rB to enter Bootloader ByPass mode”);
WriteToHostUART(“\r (RESET will Reset Freescale)”);
WriteToHostUART(“\rC to enter Custom ByPass Mode”);
WriteToHostUART(“\r (RESET Button Resets EMBER)”);
WriteToHostUART(“\r (Power Off to reset Freescale)”);
WriteToHostUART(“\rF for an OTA Flash Update”);
WriteToHostUART(“\rI to cause an Illegal Instruction Reset”);
WriteToHostUART(“\rR to force a Watchdog Reset”);
WriteToHostUART(“\rS to sleep module”);
WriteToHostUART(“\rV to Read APP Reserved Flash”);
WriteToHostUART(“\rW to Write APP Reserved Flash”);
WriteToHostUART(“\rE to Erase APP Reserved Flash”);
WriteToHostUART(“\rQ to Quit this menu\r>”);

while(SCI1S1_RDRF == 0){//Wait to Receive Usr Char
  WDR();
}
RxCharHost = SCI1D;
if(RxCharHost>='a' && RxCharHost<='z'){
  RxCharHost = RxCharHost - ('a' - 'A');//Change to upper case.
}
WRITE_CHAR_TO_HOST (RxCharHost);

switch (RxCharHost){
  case 'A' : ResetHardware(APP_CAUSE_BOOTLOADER_MENU);//never returns
  case 'B' : ResetHardware(APP_CAUSE_BYPASS_MODE);//never returns
  case 'C' : ResetHardware(APP_CAUSE_REQUEST_SOPT1_NOT_WRITTEN);//never returns
  case 'R' : WriteToHostUART("\rCausing Watchdog Reset");
             for(;;);//watchdog reset
  case 'I' : __asm JMP ILLEGAL_INSTRUCTION;//never returns
  case 'F' : GetHexAddressForOTAUpdate();
             break;
  //case 'S' : SleepModule();
  //           break;                      
  case 'V' : WriteToHostUART(CR);
             WriteToHostUART(flashStorage->message);
             WriteToHostUART(CR);
             break;                      
  case 'W' : GetNewMessageForFlash();
             break;
  case 'E' : EraseReservedFlashBlock();                                            
             break;
  case 'Q' : exitMenu = 1;//exit menu
             break;           
  default  : //exitMenu = 1;//exit menu
             break;
}//switch

}//while

}

try 9600 baud after returning to the bootloader.

type

a command prompt menu should be displayed.

Thanks. I forgot that bootlaoder and application bauds are independent. Setting radio uart by SCI2BD = UART_BAUD_115200 is not enough, because the radio will still work on 9600.

I tried something like the code below, but it didn’t work.

void high_bd_set(){
const char HIGH_DB[] = {0x07};
WriteAtCommandRadioLen(“BD”,HIGH_DB,1);
InitRadioUART_115200(void);
}

where InitRadioUART_115200 is similar to original InitRadioUART except for SCI2BD = UART_BAUD_115200

Another question. Using standard Xbee modules I had very good transparent connection (one coordinator and one router on the table). Router is connected the a meter device wchich continuously sends data with 4800 on RS485 (about 3kB). I replaced router with programmable one to have bigger host buffer (#define HOST_BUFFER_SIZE 840) but I’ve got a very large number of borken packets. Almost every packet have errors. The meter sends only ASCII chars with 7E1 mode. What can be the cause?

I can see how packets are send to radio urart. But where are handled packets from radio about transmit status?

The transparent Application you have is only an example.
It has a bunch of features to demo how to solve different problems.
The UART between the Programmable and the Radio is interrupt driven.
Where the UART between the Programmable and external to the 485 is polled.
You are loosing data because of the Polled UART and long main loop.
You need to change the extra UART to be interrupt driven, and then you should be able to get every character without loss.

I know it is only example program but right now I’ve gor very limited time to write more or less working application to present to my management. After that I hope I will be given enough time to code it right. But so far it’s not working well…

I can’t find the routine that describes radio uart interrupt.
And I still don’ know how rto change radio baud.
Maybe there are some more examples I don;t know about.

You will have to dig through the code.
The interrupt stuff is already there, check out the initUART code and EnableHostUARTIsr compared to the commented out Disable code.

You will need to change main() a bit to handle the interrupt routine rather than the polling method.

Unfortunately, it will take some time.

Almost working…
I added trasmit status frame handling and I’ve got one question. How to estimate maximum time in ms after transmit request sending to get transmit status?

I think there is a bug in ReadApiRadio() function. Each time after reset 22nd received frame is broken. I think it is connected with wrapping radioRxBuf.