Hello,
I am working on STM32F103ZGT6 with Keil Compiler. The version of Keil & other info are as below, IDE-Version: µVision V4.23.00.0
Tool Version Numbers: Toolchain: MDK-ARM Standard Version: 4.23 Toolchain Path: C:\Keil\ARM\BIN40 C Compiler: Armcc.Exe V4.1.0.894 Assembler: Armasm.Exe V4.1.0.894 Linker/Locator: ArmLink.Exe V4.1.0.894 Librarian: ArmAr.Exe V4.1.0.894 Hex Converter: FromElf.Exe V4.1.0.894 CPU DLL: SARMCM3.DLL V4.23 Dialog DLL: DARMSTM.DLL V1.63.0.0 Target DLL: UL2CM3.DLL V1.95 Dialog DLL: TARMSTM.DLL V1.60
I am facing a weird problem, that STm32 is resetting for the smallest change in Code.
For example : #define GuiConst_DISPLAY_WIDTH_test 480 #define GuiConst_BYTE_LINES_test 272 #define GuiConst_DISPLAY_BYTES_test (GuiConst_DISPLAY_WIDTH_test*GuiConst_BYTE_LINES_test)
And somewhere in my code, I have statements as below. for(i = 0; i < (GuiConst_DISPLAY_BYTES_test); i++) { LCD_Data_Disp_Transfer(k); } , If the above code is present, the micro is working properly, where "GuiConst_DISPLAY_BYTES_test" is a Macro as defined above.
If I change it to "GuiConst_DISPLAY_WIDTH_test" in "for" loop, the STM32 starts resetting once it is in Debug Mode, it resets automatically every one sec automatically. Actually it is not reaching till this "for" loop at all. I can see that, it is entering into "main()", but after executing some functions in "main()", it resets automatically.
Can you please tell me, what could be the problem. Should I have to update Keil, for this new STM32F103ZT6. Please guide me.. I have wasted lot of time in trail and error.
I have just posted an example where it is affecting.. But actually it is affecting in many more places. For many more changes. it is becoming difficult for me to do any changes and debug my development.
Rgds Shankar B T shankar.tangai@ika.in
It is irrelevant if 480 is height or width. Your loop do 481 steps. What memory gets accessed by that?
If display looks wrong if you write 480 instead of 481 columns: don't you think that is a reason to try to figure out what is wrong instead of just increasing the number of columns written?
Hmm..
I understand what u r telling..
But if you see my code in the explainations above, I am not accessing any memory or buffer. They are direct values (constant) values. Currently I am just using GPIO pins to transfer the data.
LCD_Data_Disp_Transfer(0x003F); -------- Where 0x003F is the Color code for displaying RED.
F.Y.I void LCD_Data_Disp_Transfer(void) { GPIOD->BRR = GPIO_Pin_7; //CHIP_ENABLED; GPIOD->BSRR = GPIO_Pin_11; //MODE_DATA; GPIOD->BSRR = GPIO_Pin_4; //RD_HIGH;
//Write data GPIOD->ODR = (GPIOD->ODR & 0x38FC) | ((value&1) << 14) | ((value&2) << 14) | ((value&4) >> 2) | ((value&8) >> 2) | ((value&0x8000) >> 5) | ((value&0x4000) >> 5) | ((value&0x2000) >> 5);
GPIOE->ODR = (GPIOE->ODR & 0x007F) | ((value&16) << 3) | ((value&32) << 3) | ((value&64) << 3) | ((value&128) << 3) | ((value&256) << 3) | ((value&512) << 3) | ((value&1024) << 3) | ((value&2048) << 3) | ((value&4096) << 3);
GPIOD->BRR = GPIO_Pin_5; //WR_LOW; // millisecond_delay(1); GPIOD->BSRR = GPIO_Pin_5; //WR_HIGH; GPIOD->BSRR = GPIO_Pin_7; //CHIP_DISABLED; }
The Display Buffer is just defined, but I am not using it in my Software.
Just now I did a small Analysis, I cahnged the size of Display Buffer as below - Earlier typedef union { GuiConst_INT8U Bytes[GuiConst_BYTE_LINES][GuiConst_BYTES_PR_LINE]; GuiConst_INT16U Words[GuiConst_BYTE_LINES][GuiConst_BYTES_PR_LINE/ 2]; } DisplayBufUnion; extern DisplayBufUnion GuiLib_DisplayBuf
-------------------- After Changing typedef union { GuiConst_INT8U Bytes[GuiConst_BYTE_LINES][10]; GuiConst_INT16U Words[GuiConst_BYTE_LINES][10/ 2]; } DisplayBufUnion; extern DisplayBufUnion GuiLib_DisplayBuf
----------------------------- The changes done to the size of Display Buffer is working fine. So, I need help to Configure this Display Buffer to External memory location of STM32 which is allocated at address 0x60000000 (FSMC Bank 1). i think we should do this by using __attribute__((section xyz)), in scatter file. I dont know much about this and how to use..
Thanks Shankar
STM32F10x_StdPeriph_Lib\Project\STM32F10x_StdPeriph_Examples\FSMC.
Thanku Danny,
I need direct help now,
I guess now I am able to allocate the RAM location for the Display Buffer by doing it as below.
In .h File typedef union { GuiConst_INT8U Bytes[GuiConst_BYTE_LINES][GuiConst_BYTES_PR_LINE]; GuiConst_INT16U Words[GuiConst_BYTE_LINES][GuiConst_BYTES_PR_LINE/ 2]; } DisplayBufUnion; extern DisplayBufUnion GuiLib_DisplayBuf __attribute__((at(0x62020000)));
In scatter File I am not sure, whether the cahnges are properly done. LR_IROM1 0x8008000 0x00100000 { ; load region size_region ER_IROM1 0x8008000 0x00100000 { ; load address = execution address *.o (RESET, +First) *(InRoot$$Sections) .ANY (+RO) } RW_IRAM1 0x20000000 0x00010000 { ; RW data .ANY (+RW +ZI) } EXT_RAM2 0x62020000 0x0080000 { ; RW data * (ZI) } }
Please check this, I am getting a warning after Software Build, warning is as below
.\ST\stm32_testprojekt.sct(15): warning: L6314W: No section matches pattern *(ZI).
But, at the moment, I am able to program STM32 and see the Display with Colors Directly.
I am not able to write anything into the Display Buffer or always has the value 0x0000 in it.. Hope I dont have right to write into Display Buffer array or it might not be activated(location 0x60000000). Please let me know..
I wrote in an earlier post: "You are posting gibberish when you don't make use of the "pre" tags for code - notice how all line breaks and indentation are lost."
Any reason why you continue to post code that gets the formatting completely garbled? Don't you think it might be a good idea to look at the "Tips for Posting Messages" visible directly above the message input box?
Posting hard-to-read code means less people will care to spend time reading it. So less people who will care to help.
Oh Sorry, I didnt realise it..
Danny, please go throught the info below. I need direct help now,
In .h File
typedef union { GuiConst_INT8U Bytes[GuiConst_BYTE_LINES][GuiConst_BYTES_PR_LINE]; GuiConst_INT16U Words[GuiConst_BYTE_LINES][GuiConst_BYTES_PR_LINE/ 2]; } DisplayBufUnion; extern DisplayBufUnion GuiLib_DisplayBuf __attribute__((at(0x62020000)));
In scatter File I am not sure, whether the cahnges are properly done.
LR_IROM1 0x8008000 0x00100000 { ; load region size_region ER_IROM1 0x8008000 0x00100000 { ; load address = execution address *.o (RESET, +First) *(InRoot$$Sections) .ANY (+RO) } RW_IRAM1 0x20000000 0x00010000 { ; RW data .ANY (+RW +ZI) } EXT_RAM2 0x62020000 0x0080000 { ; RW data * (ZI) } }
You don't need a scatter file for variables placed at absolute addresses.
You can use a scatter file for forcing placing of things, but you then use some naming scheme to match the code or variables in your program to the relevant zones specified in the scatter file.
Another thing - depending on what memory regions you use and if you want the data initialized before reaching main(), you may have to adjust the startup file to make sure that the specific memory regions are powered up and enabled. So if using memory areas in external memory, then the startup file must get the memory controller configuration for that external RAM. If using RAM located in a peripherial device, that peripherial may need to be powered up so the RAM block is powered up and accessible.
In your case, you have a rule for .ANY (+ZI) for RW_IRAM1. What would match your rule in EXT_RAM2?
If you look a the two examples you see they tell you how to set up the hardware and the Keil enviroment to use an external SRAM
SRAM This example provides a basic example of how to use the FSMC firmware library and an associate driver to perform read/write operations on the IS61WV51216BLL SRAM memory mounted on STM3210E-EVAL board.
SRAM DataMemory This example shows how to use the external SRAM mounted on STM3210E-EVAL or STM32100E-EVAL board as program data memory and internal SRAM for Stack.
In each of the example directories there is a readme file listing the steps.
I dont work with the STM32F10X family on a day to day basis so am not really able to advise you much more than to point you at ST provided examples set up for the Keil Tools.
Sorry
Hmm,
I am quite confused about these settings.
In STM32 there is a Memory Space "FSMC bank1 & bank2", which is located at location 0x60000000 till 0x6FFFFFFF. As the SRAM size of STM32103FZGT6 is 96K, I feel, I need more RAM to store the Display Data, which is in "GuiLib_DisplayBuf[][]" of size 261120 bytes.
Frankly telling, I dont have much idea of Scatter File.
I just want a solution for allocating the variable "GuiLib_DisplayBuf[][]" to FSMC bank location of STM32. During declaration of "GuiLib_DisplayBuf[][]" as below I have allocated it to 0x60020000.
typedef union { GuiConst_INT8U Bytes[GuiConst_BYTE_LINES][GuiConst_BYTES_PR_LINE]; GuiConst_INT16U Words[GuiConst_BYTE_LINES][GuiConst_BYTES_PR_LINE/ 2]; } DisplayBufUnion; extern DisplayBufUnion GuiLib_DisplayBuf __attribute__((at(0x60020000)));
After doing this, i am getting a warning
.\ST\stm32_testprojekt.sct(19): warning: L6314W: No section matches pattern *(ZI).
with build details
Program Size: Code=46242 RO-data=38542 RW-data=316 ZI-data=408852
I dont know exactly, what is this ZI.
Now, I want to know what changes should be done in scatter file or any other file.
Rgds Shankar
No. It isn't your line:
extern DisplayBufUnion GuiLib_DisplayBuf __attribute__((at(0x60020000)));
that is generating the warning.
It's your change to the scatter file that is generating the warning.
ZI, by the way, stands for zero-initialized variables.
Why do you manually create a scatter file, unless you use any features that requiers a scatter file? If you use your "at" declaration in the code, and add the address range of your external RAM in the project settings, you can ignore that scatter file.
But whatever you do, you must make sure that the startup file configures the memory controller for that external RAM range.
This example shows how to use the external SRAM mounted on STM3210E-EVAL or STM32100E-EVAL board as program data memory and internal SRAM for Stack. This example doesn't use the default library startup files. Use the EWARM, MDK-ARM, HiTOP, RIDE or TrueSTUDIO startup files provided within this folder.
/**********************/ Just a quick point - remember I was swagging it and havent a scoobie about your hardware!
Does the display have built in display RAM ? - Do you have the commands to read/write to the display RAM ? ( if this is the case you just set up the micro as standalone and set up the FSMC to drive the display - loads of examples of that.
If your using emWin and a display they support check the Keil boards examples to see what needs to be done.
I doubt its the compiler version that needs to changed just getting the right hardware config etc
Thank you very much to all of you.
Thanks a lot for your valuable time. I will work a little bit and learn it properly in the Documents referred by you..
If any further doubts, will post my comments here..