Skip to content

Serial Connection

Joshua Besneatte edited this page Apr 26, 2024 · 2 revisions

The USB plug on the Codi can be used to access its XR871ET main chip by using serial protocol with a non standard wiring. This allows reading real-time debug info from the robot and communication with the phoenixMC program in the XR871 SDK.

Codi Serial Connection Using a 5 pin male micro USB plug and a Silicon Labs CP210x UART Bridge the XR871 may be accessed for reading debug information and programming. Connect the output of the bridge to the usb plug as follows:

Bridge +5V-----> USB pin #1 --> Charge Codi

Bridge GND---> USB pin #5 --> Codi Ground

Bridge TX------> USB pin #4 --> XR871 Pin #48 UART0_RX

Bridge RX -----> USB pin #3 --> XR871 Pin #49 UART0_TX

Set up a 115200 baud serial connection to the Codi. In Linux I'm using screen like this:

$ screen /dev/ttyUSB0 115200

Then I press C-a+H to log terminal output to a file. This is important as the terminal doesn't format it well and it goes by too fast to read anything. You can comb the output of the log file later.

Now turn the Codi on and you will get tons of debug info. You will also be able to send commands to the processor. Type something in and hit enter and you will find something like this in your output log:

$ help [cmd ERR] cmd_exec():51, unknown cmd 'help'

$ exit [cmd ERR] cmd_exec():51, unknown cmd 'exit'

Well, it is listening....

If I run ./phoenixMC -b 115200 -D r the program is able to see the chip and read the "Debug Flash" and saves it to a 512 byte bin file. Don't know yet what this does other than proving the SDK can talk to the chip.

I haven't tried writing anything to the chip as I can't seem to download the current firmware from the chip before potentially bricking this thing.

Here's the initial debug info:

head -n 185 screenlog.0 
[CREATE] task main_task(0x3df58)
XRadio IoT WLAN SDK 1.4.0

[Flash chip A] <DefaultFlashCtor:422> Using default flash chip
[Flash DRV I] <HAL_Flash_Init:665> mode: 0x4, freq: 48000000Hz, drv: 0
[img] init: flash 0, addr 0 (0 KB), max_size 2036 KB
[img] bl size 32 KB, image (no bl) max size 2004 KB
[img] ota cfg: flash 0, size 32 KB, addr 0x200000 (2048 KB)
[img] image 0: flash 0, addr 0x00008000 (32 KB)
[img] image 1: flash 0, addr 0x00208000 (2080 KB)
[img] image_get_raw_cfg(), raw_seq 0x5555, raw_state 0x9669
[img] image_get_cfg(), seq 0, state 1
[img] img seq 0, state 1
[img] bl ver 2
[img] running seq 0
[img] image_get_section_addr(), seq 0, id 0xa5fd5a02
[CREATE] task Looper(0x3eed8)
[img] image_get_size(), seq 0, image size 0x19a1c2
[CREATE] task console(0x3edc8)
[CREATE] task tcpip(0x40c40)
[CREATE] task duccN(0x4a658)
[CREATE] task duccD(0x49de0)
[img] get running seq 0
[EFUSE_DBUG] [_efuse_mac_load 83] : mac addr : 54e5be4d8764.
[EFUSE_DBUG] [_efuse_chip_id_load 99] : chip id : 000040530c4700141841e178cc1e9608.

product_name = Pillar.
uuid = 3213411000002bc4, token = 2896a500efc6ce7761.
reserved = -.


==================================================================
 FIRMWARE VERSION : 1.1.3.9	FIRMWARE TIME : 20201120
==================================================================

SDC source:24 MHz clock=400 kHz,src:0, n:1, m:14
SDC source:24 MHz clock=400 kHz,src:0, n:1, m:14
SDC source:192 MHz clock=48000 kHz,src:1000000, n:0, m:1
[FS INF] mmc init
[FS INF] mount success
[CREATE] task recv_volume_msg_q_task(0x48c88)
[CREATE] task headphone_ctrl_task(0x48410)
[CREATE] task _bluetooth_ctrl_task(0x47f40)
[CREATE] task _media_msg_queue_task(0x47198)
[CREATE] task recv_ctrl_btn_msg_q_task(0x44f30)
[CREATE] task ad_button_ctrl_task(0x44cb8)
[CREATE] task battery_info_task(0x44840)
B0,BLUETOOTH CLOSE.
B0,B0,B0,B0,B0,B0,B0,B0,B0,B0,B0,B0,B0,B2609,B2609,B2609,B2612,B2612,B2604,B2604,B2613,B2613,B2613,B2609,B2609,B2610,B2610,B2610,B2614,
[VOICE_DEBUG] [play_voice 150] : tone url = flash://0?addr=1465532&length=10377.
[MEDIA_Q_DBUG] [_media_msg_send 512] : play_voice, 171, src = 2.
[MEDIA_Q_DBUG] [_media_msg_queue_task 549] : (0) MSG_PLAY
[CREATE] task _player(0x43948)
XRADIO IOT CEDARX 1.2.22
5dbff9f1
[CREATE] task pthread(0x42420)
[Cedarx OS porting INFO] pthread_create line 517, thread: 0x42420 create success!
[CREATE] task pthread(0x41f20)
[Cedarx OS porting INFO] pthread_create line 517, thread: 0x41f20 create success!
xplayer thread dealing with msg.messageId: 0x103
[Awplayer info] <awplayer_seturl : 459> request to play : flash://0?addr=1465532&length=10377
xplayer thread dealing with msg.messageId: 0x101
set url complete
xplayer thread dealing with msg.messageId: 0x104
prepare finish
parser create success
prepare cmd finish
impl->keyinfo: flash://0?addr=1465532&length=10377
After controll stream, start pos : 45, size : 10332
probeData->len: 4096, impl->file_offset: 45
parser create success
mp3 parser init success
[CREATE] task pthread(0x41310)
[Cedarx OS porting INFO] pthread_create line 517, thread: 0x41310 create success!
[CREATE] task pthread(0x4d2e0)
[Cedarx OS porting INFO] pthread_create line 517, thread: 0x4d2e0 create success!
prepare reply finish
prepare complete
[Awplayer info] <awplayer_handler_preprocess : 194> event: 1
[MEDIA_Q_DBUG] [ococci_player_callback 190] : ococci player event : 1.
xplayer thread dealing with msg.messageId: 0x105
[Awplayer debug] <play : 177> playing.
[Awplayer info] <awplayer_tell : 488> tell to 71 ms.
[Awplayer info] <awplayer_tell : 488> tell to 2952 ms.
[Awplayer info] <awplayer_callback : 320> playback complete.
[Awplayer info] <awplayer_handler_preprocess : 194> event: 8
xplayer thread dealing with msg.messageId: 0x108
[Awplayer info] <awplayer_callback : 333> cedarx cb complete.
[MEDIA_Q_DBUG] [ococci_player_callback 190] : ococci player event : 8.
[MEDIA_Q_DBUG] [_media_msg_send 512] : play_voice, 190, src = 2.
[CREATE] task _burn_product_info(0x41be8)
[MEDIA_Q_DBUG] [_media_msg_queue_task 561] : (0) MSG_RESUME
[EFUSE_DBUG] [_efuse_mac_load 83] : mac addr : 54e5be4d8764.
[FACTORY_BURN_WARN] [_burn_product_info 941] : [ 0 | 0 ] mac_exist(1), product_info_exist(1), product_info_backup_exist(1).
[FACTORY_BURN_INFO] [burn_product_info 1147] : mac_and_id_flag = 3, SupportAirBurnID=0
[EFUSE_DBUG] [_efuse_mac_load 83] : mac addr : 54e5be4d8764.
[EFUSE_DBUG] [_efuse_chip_id_load 99] : chip id : 000040530c4700141841e178cc1e9608.

product_name = Pillar.
uuid = 3213411000002bc4, token = 2896a500efc6ce7761.
reserved = -.
[CREATE] task _sleep_check_init(0x41920)
[CREATE] task _local_audio_init(0x41040)
[DEV_WARN] [load 70] : {"playing_name":"file://AllPlaylist/Undead Witch.mp3","play_time":14464,"category":0}.
[LOCAL_AUDIO_WARN] [update_playlist 336] : count[0] = 6.
[LOCAL_AUDIO_WARN] [update_playlist 336] : count[1] = 0.
[LOCAL_AUDIO_WARN] [update_playlist 336] : count[2] = 0.
[VOICE_DEBUG] [play_voice 150] : tone url = flash://0?addr=1290338&length=5556.
[MEDIA_Q_DBUG] [_media_msg_send 512] : play_voice, 171, src = 2.
[MEDIA_Q_DBUG] [_media_msg_queue_task 549] : (0) MSG_PLAY
[CREATE] task _player(0x43a20)
[net INF] no need to switch wlan mode 0
[CREATE] task _wifi_ap_scan_task(0x43a88)
[WIFI_SCAN_INFO] [_wifi_ap_scan_task 88] : size = 50, num = 0.
[Awplayer info] <awplayer_seturl : 459> request to play : flash://0?addr=1290338&length=5556
xplayer thread dealing with msg.messageId: 0x101
set url complete
xplayer thread dealing with msg.messageId: 0x104
prepare finish
parser create success
prepare cmd finish
impl->keyinfo: flash://0?addr=1290338&length=5556
After controll stream, start pos : 45, size : 5511
probeData->len: 4096, impl->file_offset: 45
parser create success
mp3 parser init success
[CREATE] task pthread(0x55928)
[Cedarx OS porting INFO] pthread_create line 517, thread: 0x55928 create success!
[CREATE] task pthread(0x54608)
[Cedarx OS porting INFO] pthread_create line 517, thread: 0x54608 create success!
prepare reply finish
prepare complete
[Awplayer info] <awplayer_handler_preprocess : 194> event: 1
[MEDIA_Q_DBUG] [ococci_player_callback 190] : ococci player event : 1.
xplayer thread dealing with msg.messageId: 0x105
[Awplayer debug] <play : 177> playing.
[Awplayer info] <awplayer_tell : 488> tell to 72 ms.
[net INF] msg <wlan scan success>
[NETWORK_DBUG] [net_event_cb 562] : SCAN_SUCCESS
[NETWORK_WARN] [net_event_cb 564] : scan_success_timeout 1
[WIFI_SCAN_INFO] [_wifi_ap_scan_task 88] : size = 50, num = 3.
[WIFI_SCAN_DBUG] [_wifi_ap_scan_task 94] : [0] ssid = <redacted>
[net INF] msg <wlan scan success>
[NETWORK_DBUG] [net_event_cb 562] : SCAN_SUCCESS
[NETWORK_WARN] [net_event_cb 564] : scan_success_timeout 2
[Awplayer info] <awplayer_callback : 320> playback complete.
[Awplayer info] <awplayer_handler_preprocess : 194> event: 8
xplayer thread dealing with msg.messageId: 0x108
[Awplayer info] <awplayer_callback : 333> cedarx cb complete.
[MEDIA_Q_DBUG] [ococci_player_callback 190] : ococci player event : 8.
[LOCAL_AUDIO_DBUG] [player_seek_to_song 501] : category = 0.
[LOCAL_AUDIO_DBUG] [player_seek_to_song 515] : seek file://AllPlaylist/Undead Witch.mp3 complete.
[MEDIA_Q_DBUG] [_media_msg_send 512] : _play_songs, 592, src = 3.
[MEDIA_Q_DBUG] [_media_msg_queue_task 549] : (0) MSG_PLAY
[CREATE] task _player(0x3cf98)
[Awplayer info] <awplayer_seturl : 459> request to play : file://AllPlaylist/Undead Witch.mp3
xplayer thread dealing with msg.messageId: 0x101
set url complete
xplayer thread dealing with msg.messageId: 0x104
prepare finish
prepare cmd finish
parser create success
impl->keyinfo: file://AllPlaylist/Undead Witch.mp3
After controll stream, start pos : 2247911, size : 2661273
probeData->len: 4096, impl->file_offset: 2247911
parser create success
[CREATE] task check_audio_download_task(0x43a20)
[DL_WARN] [check_audio_download_task 469] : check_audio_download_task pending
mp3 parser init success
[CREATE] task pthread(0x55af0)
[Cedarx OS porting INFO] pthread_create line 517, thread: 0x55af0 create success!
[CREATE] task pthread(0x547d0)
[Cedarx OS porting INFO] pthread_create line 517, thread: 0x547d0 create success!
prepare reply finish
prepare complete
[Awplayer info] <awplayer_handler_preprocess : 194> event: 1
[MEDIA_Q_DBUG] [ococci_player_callback 190] : ococci player event : 1.
xplayer thread dealing with msg.messageId: 0x10a
[Awplayer info] <awplayer_seek : 433> seek to 14464 ms.
xplayer thread dealing with msg.messageId: 0x105
[Awplayer debug] <play : 177> playing.
[Awplayer info] <awplayer_tell : 488> tell to 14464 ms.
[WIFI_SCAN_INFO] [_wifi_ap_scan_task 88] : size = 50, num = 3.
Clone this wiki locally