Problems compiling code for AT32F403 - Page 1
Forum section: electronics / general

author: cloidnerux
author_rank: Contributor
timestamp: May 30, 2019, 03:16:33 pm
content: Hello,I try to build a EV with some hoverboard motors, for that I bought a hoverboard mainboard in order to flashthis code.However, on the board is an Artery AT32F403RCT6 which seems to be a Cortex-M4 device for the Chinese market which is compatible with the STM32F103RCT6 and the GD32F403RCT6.In order to test the device I compiled one of the example projects using KEIL uVision and uploaded it successfully to the MCU with a Segger J-Link Edu mini.From this I tried to get the arm-gcc toolchain to work, however, it seems I did something wrong. It compiles successfully and is loaded into the flash, but it does not work. Or to be more precise: There is a self-hold circuit the MCU has to set which it does not. It works fine with the uVision binary, but not my arm-gcc code.So, does anybody have a clue for me on what I might be doing wrong?It is the same exact code for both projects. I triple checked my startup-code and my linker script to be somewhat sane.I verified my jlink-script, which works correctly.Comparing the two hex files(the working one from uVision and my arm-gcc one) the interrupt vectors seem to be correct, the stack initializer is within the RAM, the code is correctly aligned.I guess there is either some interrupt problem resulting from misaligned functions or gcc optimizing variables away which it should keep.

author: GromBeestje
author_rank: Frequent Contributor
timestamp: May 30, 2019, 03:40:02 pm
content: I've never heard of artery, but I know of ST and GigaDevice.I'm note quite sure what you mean by self-hold circuit.However, some generic things to checkI see the linker file mentioning ( It's named STM32F103RCTx_FLASH.ld )QuoteVerify your part actually has 96K of RAM. If it has less RAM, it will HardFault immidiately after start up (in the reset_handler)If the part number follows the same naming convention as ST and GigaDevice parts, your device has only 64K RAM.

author: cloidnerux
author_rank: Contributor
timestamp: May 30, 2019, 04:35:34 pm
content: QuoteIt seems no one has really heard of Atery yet, there is almost nothing on the internet about it.QuoteThe hoverboards don't switch on unless you press a button, after this the microcontroller switches on a transistor to keep the main switch closed.QuoteWell, it seems we have a winner. I changed the maximum SRAM size to 64k and the stack start to C000 and it now seems to do what I want it to do.QuoteI naively followed the datasheet from Atery, which claims 96k + 128k of SRAM for all their devices. Somehow this seems to not be the case.

author: ebastler
author_rank: Super Contributor
timestamp: May 30, 2019, 05:53:50 pm
content: Quote from: cloidnerux on May 30, 2019, 04:35:34 pmAnd they have chosen their company name wisely. Just Google "Artery ARM" or "Artery Cortex", and you will learn more about medicine than you ever wanted to know...

author: GromBeestje
author_rank: Frequent Contributor
timestamp: May 30, 2019, 09:06:18 pm
content: They're indeed hard to find when you only know they name. I had to add the part name to find the company: which giveshttp://www.arterytek.comGoogeling for "artery tek" finds the company right awayhttp://www.arterytek.com/download/Flyer_AT32F403Series_SC_v1002.pdfI can't read it, but it says 96+128 with some note (2)Seeing two memory amounts with a +, makes me think it might have two memory banks, or something like that.

author: mikerj
author_rank: Super Contributor
timestamp: May 30, 2019, 09:43:47 pm
content: Quote from: AT32F403Looks like a chunk of the RAM can be configured to shadow flash for zero wait state operation.

author: sjamthe
author_rank: Newbie
timestamp: June 08, 2019, 02:56:58 am
content: Hello,I also ended up with the same micro controller and howerboard from ebay. Looking for the following guidance1. Are the SWD pins the same? I am trying to connect to the board without 3.3V (but board powered) but cannot detect the micro controller.2. Is there anything else different on your black board? Fore instance my gyro boards don't have STM or any other visible controller but my green one did. The wiring is different too.thanks

author: sjamthe
author_rank: Newbie
timestamp: June 30, 2019, 11:24:17 pm
content: Hello cloidneruxI have the same MU, board and am struggling with the same problem.I am unable to get openocd or stlink to identify the chip. I get device id 0x70050242How did you get pas this problem?thanks

author: marcosB
author_rank: Newbie
timestamp: March 03, 2021, 02:01:38 pm
content: Hi cloidnerux and sjamthe,I have the same issue (the device id is also 0x70050242). Until now I figured out that the AT32F403 isn't compatible with STM323F1 (well one ist an ARM Cortex-M4 and the other in a M3). So, do you have any ideas or even a solution for this compatibility problem?Thanks

author: brnpimenta
author_rank: Newbie
timestamp: July 20, 2021, 10:41:13 pm
content: Hey guys,I found the github repository that has the firmware and it describe how to reprogram the board in general and I'm struggling to understand it.can you guys describe a procedure detailed of how to reprogram the board with at32f403 chip?Regards,Bruno Oliveira