# RTL8720DN/BW16 firmware boot problem

**URL:** <https://forum.amebaiot.com/t/rtl8720dn-bw16-firmware-boot-problem/1169>\
**Category:** SDK\
**Tags:** rtl872xd, evb-bw16\
**Created:** [March 25, 2022, 3:54pm UTC](https://forum.amebaiot.com/t/rtl8720dn-bw16-firmware-boot-problem/1169 "2022-03-25T15:54:41Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![kilimanjaro](https://avatars.discourse-cdn.com/v4/letter/k/6de8d8/32.png) [@kilimanjaro](https://forum.amebaiot.com/u/kilimanjaro)\
**Post date:** [March 25, 2022, 3:54pm UTC](https://forum.amebaiot.com/t/rtl8720dn-bw16-firmware-boot-problem/1169/1 "2022-03-25T15:54:41Z")

</div>

Hey,  
I started development with Standard SDK on BW16 module. Earlier I was playing with B&T firmware and it’s AT commands but that wasn’t enough for me. I compiled Standard SDK and tried uploading it on my RTL8720DN. I followed this guide [[Resources] BW16 Troubleshooting Guide](https://forum.amebaiot.com/t/resources-bw16-troubleshooting-guide/678) to make sure B&T firmware was erased. Then I compiled Standard SDK according to AN0400 Ameba-D Application Note.

I can successfully upload compiled binaries to my module using ameba image tool (entering UART download mode before that), but then after connecting to rtl via UART terminal it only prints “#” on startup and echoes back everything I send to him. Seems like uploaded firmware is not booting and the module stays in some bootloader code. What might be the reason?

---

<div class="post-metadata">

**Author:** ![wyy](https://avatars.discourse-cdn.com/v4/letter/w/bc8723/32.png) [@wyy](https://forum.amebaiot.com/u/wyy)\
**Post date:** [March 26, 2022, 8:26am UTC](https://forum.amebaiot.com/t/rtl8720dn-bw16-firmware-boot-problem/1169/2 "2022-03-26T08:26:20Z")

</div>

Hi @kilimanjaro

did you use the flash erase function to erase the B&T firmware?  
you might want to try activating some example code, and see if that prints out anything. it is possible that the uploaded image is just not doing anything.

---

<div class="post-metadata">

**Author:** ![kilimanjaro](https://avatars.discourse-cdn.com/v4/letter/k/6de8d8/32.png) [@kilimanjaro](https://forum.amebaiot.com/u/kilimanjaro)\
**Post date:** [March 27, 2022, 1:18pm UTC](https://forum.amebaiot.com/t/rtl8720dn-bw16-firmware-boot-problem/1169/3 "2022-03-27T13:18:13Z")

</div>

Yes, I erased flash via image tool prior to uploading Standard SDK example. It worked as there is no B&T logo printing out. I compiled Standard SDK with UART ATcmd example (inc\_hp/platform\_opts.h define CONFIG\_EXAMPLE\_UART\_ATCMD 1) but the module does not respond to my commands and does not print any messages via UART. I followed guide in application note to do that so I assume everything was done correctly

---

<div class="post-metadata">

**Author:** ![wyy](https://avatars.discourse-cdn.com/v4/letter/w/bc8723/32.png) [@wyy](https://forum.amebaiot.com/u/wyy)\
**Post date:** [March 28, 2022, 3:33am UTC](https://forum.amebaiot.com/t/rtl8720dn-bw16-firmware-boot-problem/1169/4 "2022-03-28T03:33:17Z")

</div>

@kilimanjaro  
can you try downloading from the [release branch of the SDK on GitHub](https://github.com/ambiot/ambd_sdk/tree/release). I have just testing compiling with it and the output is normal.

---

<div class="post-metadata">

**Author:** ![kilimanjaro](https://avatars.discourse-cdn.com/v4/letter/k/6de8d8/32.png) [@kilimanjaro](https://forum.amebaiot.com/u/kilimanjaro)\
**Post date:** [March 28, 2022, 4:38pm UTC](https://forum.amebaiot.com/t/rtl8720dn-bw16-firmware-boot-problem/1169/5 "2022-03-28T16:38:15Z")

</div>

@wyy  
Simple solution, yet it worked! I used master branch version of Standard SDK, release version works without any problems.

I have another question, don’t know if I should start new topic but I’ll ask here.  
I use RTL8720DN as a slave controlled by other uC through AT commands. I want it to provide connection to Azure IoT Hub using TLS 1.2, there is also a custom certificate needed. Can you suggest some examples to start with? I tried to implement an open source mqtt stack on my uC that used TCP socket on RTL controlled via AT commands, but I couldn’t establish secure connection.

---

<div class="post-metadata">

**Author:** ![wyy](https://avatars.discourse-cdn.com/v4/letter/w/bc8723/32.png) [@wyy](https://forum.amebaiot.com/u/wyy)\
**Post date:** [March 29, 2022, 2:36am UTC](https://forum.amebaiot.com/t/rtl8720dn-bw16-firmware-boot-problem/1169/6 "2022-03-29T02:36:39Z")

</div>

@kilimanjaro

you might want to refer to [AN0075](https://github.com/ambiot/ambd_sdk/tree/master/doc) and the UART\_ATCMD example, it appears to have commands for TCP/UDP/SSL client and server

---

<div class="post-metadata">

**Author:** ![kilimanjaro](https://avatars.discourse-cdn.com/v4/letter/k/6de8d8/32.png) [@kilimanjaro](https://forum.amebaiot.com/u/kilimanjaro)\
**Post date:** [March 29, 2022, 5:41pm UTC](https://forum.amebaiot.com/t/rtl8720dn-bw16-firmware-boot-problem/1169/7 "2022-03-29T17:41:38Z")

</div>

OK, thanks

---

<div class="post-metadata">

**Author:** ![boatbodger](https://avatars.discourse-cdn.com/v4/letter/b/82dd89/32.png) [@boatbodger](https://forum.amebaiot.com/u/boatbodger)\
**Post date:** [April 14, 2022, 5:31pm UTC](https://forum.amebaiot.com/t/rtl8720dn-bw16-firmware-boot-problem/1169/8 "2022-04-14T17:31:54Z")

</div>

I was stuck at the same point @kilimanjaro was stuck.  
I am following AN400 - but don’t want to use hardware debugging.  
I used git clone [GitHub - ambiot/ambd\_sdk: Release SDK for AmebaD](https://github.com/ambiot/ambd_sdk.git)  
to pull down the SDK to my Linux VM  
Having used chmod -R 777 ambd\_sdk (rather brutal!) to fix the lack of -x permissions on the various .sh and .py files, I did a compile without any changes - it compiled perfectly.  
I then used imagetool to push the three files to an rtlduino board using an FTDI adaptor.  
The upload appeared to go fine - but I notice that system.bin is not ticked - should it be? What does it do?

 ![image](https://us1.discourse-cdn.com/flex016/uploads/ameba/original/1X/58880f8d7e9dd86e63f3a6c66e2e9fd9a450cff7.png)

I get just the #symbol on startup on the Log\_ port. I can get some kind of monitor to run (similar to the one on the BW16 default firmware), but I don’t see the ‘calibration ok’ message.  
I notice that the KM0 boot file is just 236 bytes long, whereas screenshots suggest it should be about 4k.

Now I’m not as fluent with git as I need to be, but eventually I worked out that the download gives you the ‘master’ branch even when the dropdown at top left of the link kindly provided by wyv is set to ‘release’.  
Tinkering around with git commands, I managed to ‘git checkout -f release’ (had to use the -f flag to blow away the broken ‘master’ branch), re-did the chmod -R command, compiled everything again. uploaded, and now I see sensible things on the Log port for an ‘empty’ application.

 ![image](https://us1.discourse-cdn.com/flex016/uploads/ameba/original/1X/a53706bef22e0a72216e4f16b9e8d9eb2d8b9d28.png)

And when I enable the AT commands, I see the string AT\_UART\_CONF: 38400 etc - but nothing on the second UART - so I guess I now need to start checking out the pinmux settings!.

Onward and upward…

---

<div class="post-metadata">

**Author:** ![wyy](https://avatars.discourse-cdn.com/v4/letter/w/bc8723/32.png) [@wyy](https://forum.amebaiot.com/u/wyy)\
**Post date:** [April 14, 2022, 6:12pm UTC](https://forum.amebaiot.com/t/rtl8720dn-bw16-firmware-boot-problem/1169/9 "2022-04-14T18:12:21Z")

</div>

> [@boatbodger](#):
>
> The upload appeared to go fine - but I notice that system.bin is not ticked - should it be? What does it do?

system.bin corresponds to the system data region of flash. As seen in Chapter 9.1.2 and 29.3.3 of the application note, it is used for activating BLE debug capability on certain pins. It is fine to leave it empty.

- There is a “default” AT command interface on the LOG\_UART pins, which do not need to be specifically enabled. You can control WiFi, BLE, TCP from it.
- Some examples may enable a different AT command interface on other UART pins. This may use a set of AT commands that are different from the first.

---

<div class="post-metadata">

**Author:** ![boatbodger](https://avatars.discourse-cdn.com/v4/letter/b/82dd89/32.png) [@boatbodger](https://forum.amebaiot.com/u/boatbodger)\
**Post date:** [April 14, 2022, 6:21pm UTC](https://forum.amebaiot.com/t/rtl8720dn-bw16-firmware-boot-problem/1169/10 "2022-04-14T18:21:27Z")

</div>

re system.bin - thanks for the explanation, and sorry I missed that in the AN.  
Re default AT command interface, I wasn’t seeing an AT COMMAND READY prompt, but I _was_ seeing the 38400 baud rate message, yet the Log UART still seemed to be running at 115,200.  
Anyway, whilst my end project doesn’t need to use AT commands, I thought if I can get that going, it helps me in to the SDK and prove I can actually build a working project.

Just as an experiment, I have modifed component\common\example\uart\_atcmd\example\_uart\_atcmd.h as follows:  
#elif (CONFIG\_AMEBA == AMEBAD )  
//#define UART\_TX PA\_18  
//#define UART\_RX PA\_19  
//#define UART\_RTS PA\_16  
//#define UART\_CTS PA\_17  
#define UART\_TX PB\_1  
#define UART\_RX PB\_2  
#define UART\_RTS NC  
#define UART\_CTS NC  
and I now get the AT COMMAND READY prompt on the second UART.

Thank you again for your prompt responses

---

<div class="post-metadata">

**Author:** ![wyy](https://avatars.discourse-cdn.com/v4/letter/w/bc8723/32.png) [@wyy](https://forum.amebaiot.com/u/wyy)\
**Post date:** [April 14, 2022, 7:33pm UTC](https://forum.amebaiot.com/t/rtl8720dn-bw16-firmware-boot-problem/1169/11 "2022-04-14T19:33:16Z")

</div>

The LOG\_UART pins are default configured to 115200 unless reconfigured in code. I believe the 38400 message is indicating the baud rate for the other UART port, since it also serves as a default output for debug messages in addition to accepting AT commands

I believe there is no specific AT COMMAND READY message on the LOG\_UART port. Normally I just hit enter once for the `#` prompt to show up, then use ATW0 / ATW1 to connect to wifi.

---

<div class="post-metadata">

**Author:** ![lamb](https://avatars.discourse-cdn.com/v4/letter/l/dfb087/32.png) [@lamb](https://forum.amebaiot.com/u/lamb)\
**Post date:** [April 15, 2022, 4:17am UTC](https://forum.amebaiot.com/t/rtl8720dn-bw16-firmware-boot-problem/1169/12 "2022-04-15T04:17:39Z")

</div>

its booting off OTA2 image. Do a “flash write 08106000 0” to corrupt the OTA2 image. Then OTA1 should boot. wrote a serial script to “flash write 08106000 0” then a “reboot uartburn” and then call the Linux tool “tools/linux/image\_tool/amebad\_image\_tool /dev/ttyUSBx” to upload km0\_km4\_image.bin for “production”.

---

<div class="post-metadata">

**Author:** ![garvanz0](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/garvanz0/32/2425_2.png) [@garvanz0](https://forum.amebaiot.com/u/garvanz0)\
**Post date:** [January 9, 2025, 2:53am UTC](https://forum.amebaiot.com/t/rtl8720dn-bw16-firmware-boot-problem/1169/13 "2025-01-09T02:53:52Z")

</div>

you are not putting it in development mode, press the boot button for 5 seconds and disconnect the cable without releasing the button, now connect the cable with the button on for 2 seconds and then release it, you will see that the red LED turns on and that indicates that you can now load your firmware and to start it just disconnect and reconnect
