|
|
|
Troubleshooting tips and bug reports
General - Use oscilloscope and/or voltage meters to solve hardware problems. (Check if the lines are solid, short-circuits, correct voltages, etc.) - See the datasheets of the components for help of their operation. They usually contains the reference schema of how to use them. - Read the manuals. MCU and code - If the MCU does not start running your code and resets continuously, you probably have compiled the code to a wrong MCU or wrong socket in the emulator. - If the MCU does not start at all, check the clock signal (with oscilloscope) and the configuration bits (in the emulator) for the correct clock source. GNU-compiler - Check that you have selected the right MCU in the makefile! Wrong MCU causes sudden resets in the MCU. - There are some problems with handling global arrays. There seems to be a bug in the compiler. - The coff-file produced by the conventional make coff-command package does not include address information of variables.Thus you are not able to see the values of the variables in the emulator. However, there is a recent update, which does include the variables. Use make extcoff to get the variables visible, and use this makefile. IAR-compiler - Check that you have selected the right MCU. Memory-problems? In a microcontroller you can directly control the allocation of memory and placing variables into different segments in memory. If you get weird errors of how there's no sram in use or stack is too big, you need to check the memory settings of your system. In IAR compiler choose Project-options menu, XLINK-category and List-tab. There select "Generate linker listing", "Segment map" and "symbol listing" or "Module map". You get different outputs with different settings. These options produce a .map-file into to your Debug/-directory under your project folder. These files tell you where everything is located. If you declare variables inside functions, they usually go into cstack-segment. These are not shown separately in these files. All the memorysettings can be modified either with an .xcl-file or in the IAR Embedded workbench menus. You can download the .xcl files with default settings here: ATmega32 and ATmega161. The .xcl file is used by choosing project-options menu, general-category and target-tab, uncross the "Configure system using dialogs (not in .XCL file)" and then from the XLINK-category and include-tab, choose XCL filename, override default, and browse for your own file. If you want to configure things using menus, then you must have the project-options menu, general-category and target-tab, "Configure system using dialogs (not in .XCL file)" selected, and the you can make modifications via "Library configuration" and "System configuration" tabs. So basically, if you have big arrays defined inside functions, they go to cstack-segment. If your cstack-segment is 0x20 bytes, and your tables are bigger than that, you must make the cstack correspondignly bigger. If you have globally defined arrays, you can see from the .map file, where they are located. Then you can correspondingly make that segment bigger. You can also define your own memroy segments with .xcl-file, and locate your arrays or variables there using a #pragma datasegment (see tha IAR compiler manual). For example: #pragma dataseg=MY_SEGMENT __no_init char myBuffer[1000]; #pragma dataseg=default For the GNU environment, things can be done with the makefile. For more instructions see this page: http://users.rcn.com/rneswold/avr/index.html. UART - Check that the lines go correctly (with oscilloscope). The footprint of your component could be mirrored. |