Author Topic: Problems compiling code for AT32F403  (Read 4843 times)

0 Members and 1 Guest are viewing this topic.

Offline cloidneruxTopic starter

  • Contributor
  • Posts: 23
Problems compiling code for AT32F403
« on: May 30, 2019, 03:16:33 pm »
Hello,

I try to build a EV with some hoverboard motors, for that I bought a hoverboard mainboard in order to flash this 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.


 

Offline GromBeestje

  • Frequent Contributor
  • **
  • Posts: 285
  • Country: nl
Re: Problems compiling code for AT32F403
« Reply #1 on: May 30, 2019, 03:40:02 pm »
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 check
I see the linker file mentioning ( It's named STM32F103RCTx_FLASH.ld )
Quote
FLASH (rx)      : ORIGIN = 0x08000000, LENGTH = 256K
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 96K
Verify 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.
« Last Edit: May 30, 2019, 04:14:55 pm by GromBeestje »
 

Offline cloidneruxTopic starter

  • Contributor
  • Posts: 23
Re: Problems compiling code for AT32F403
« Reply #2 on: May 30, 2019, 04:35:34 pm »
Quote
I've never heard of artery, but I know of ST and GigaDevice.
It seems no one has really heard of Atery yet, there is almost nothing on the internet about it.
Quote
I'm note quite sure what you mean by self-hold circuit.
The hoverboards don't switch on unless you press a button, after this the microcontroller switches on a transistor to keep the main switch closed.

Quote
Verify your part actually has 96K of RAM.  If it has less RAM, it will HardFault immidiately after start up (in the reset_handler)
Well, 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.
Quote
If the part number follows the same naming convention as ST and GigaDevice parts, your device has only 64K RAM.
I naively followed the datasheet from Atery, which claims 96k + 128k of SRAM for all their devices. Somehow this seems to not be the case.
 

Online ebastler

  • Super Contributor
  • ***
  • Posts: 7106
  • Country: de
Re: Problems compiling code for AT32F403
« Reply #3 on: May 30, 2019, 05:53:50 pm »
It seems no one has really heard of Atery yet, there is almost nothing on the internet about it.

And 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...  ;)
 

Offline GromBeestje

  • Frequent Contributor
  • **
  • Posts: 285
  • Country: nl
Re: Problems compiling code for AT32F403
« Reply #4 on: May 30, 2019, 09:06:18 pm »
They're indeed hard to find when you only know they name. I had to add the part name to find the company: which gives http://www.arterytek.com
Googeling for "artery tek" finds the company right away
http://www.arterytek.com/download/Flyer_AT32F403Series_SC_v1002.pdf  I 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.
 

Online mikerj

  • Super Contributor
  • ***
  • Posts: 3338
  • Country: gb
Re: Problems compiling code for AT32F403
« Reply #5 on: May 30, 2019, 09:43:47 pm »
Quote from: AT32F403
(1) ZW = zero wait-state, up to SYSCLK 200 MHz
  NZW = non zero wait-state
(2) Flash memory supports on-chip SRAM expansion to 224 KB. Take AT32F403ZGT6 as an example. Flash/SRAM can be set to the following two configurations:
  - ZW : 256 KB, NZW : 768 KB, RAM : 96 KB
  - ZW : 128 KB, NZW : 896 KB, RAM : 224 KB

Looks like a chunk of the RAM can be configured to shadow flash for zero wait state operation.
 

Offline sjamthe

  • Newbie
  • Posts: 2
  • Country: us
Re: Problems compiling code for AT32F403
« Reply #6 on: June 08, 2019, 02:56:58 am »
Hello,

I also ended up with the same micro controller and howerboard from ebay. Looking for the following guidance
1. 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
 

Offline sjamthe

  • Newbie
  • Posts: 2
  • Country: us
Re: Problems compiling code for AT32F403
« Reply #7 on: June 30, 2019, 11:24:17 pm »
Hello cloidnerux

I 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 0x70050242

How did you get pas this problem?

thanks
 

Offline marcosB

  • Newbie
  • Posts: 1
  • Country: br
Re: Problems compiling code for AT32F403
« Reply #8 on: March 03, 2021, 02:01:38 pm »
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
 

Offline brnpimenta

  • Newbie
  • Posts: 2
  • Country: br
Re: Problems compiling code for AT32F403
« Reply #9 on: July 20, 2021, 10:41:13 pm »
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
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf