HI Dialog Team,
Our project use two UART, one (UART1) for debug and the other(UART2) for communication with GSM Module.
if I set the static const sleep_state_t app_default_sleep_mode = ARCH_SLEEP_OFF,the UART can TX/RX data both in jtag debug mode and burn in flash mode.But if I change the app_default_sleep_mode = ARCH_SLEEP_ON.UART1 and UART2 can work in Jtag debug mode.But if I burn the fw to flash init.Only UART1 work and UART2 can not send and receive data.
I have two question:
1.Why this happen as above?
2.I try to config the app_default_sleep_mode = ARCH_SLEEP_ON.and when I want to use UART2 ,I change the sleep mode to arch_set_sleep_mode(ARCH_SLEEP_OFF),but still UART2 can not work.Thanks.
Device:
Hi zhong,
I am not that sure that i get the case and what you do exactly and where exactly you try to print but my assumption would be that you are trying to print and use the UART modules when the device is on its way to go in sleep or when the XTAL16 is powered off or hasn't been settled yet, in order to print data you need the XTAL to be stable in order to generate the required baud rate. The SDK implements the arch_printf() functionallity in order to be used for debugging and this would push the data that you would like to print in a queue and sends them over UART only when the device has a settled and properly working XTAL16 (just after all the BLE events are served). So you can either make sure that the XTAL16 is properly settled and operational (a callback where you are certain that the XTAL16 is operational is the app_on_ble_powered, so you can place the printing functions in that callback and they should be ok). I assume that the reason for the device printing while you are in sleep mode and in debug is because the debugger is still attached to the device, so it doesn't go to sleep (do you dettach the debugger when downloading the fw through JTAG ?). Apparently when running it from flash the device goes properly in sleep mode and that's why there is no printing.
Thanks MT_dialog