Originally posted by Tecstatic
View Post
Announcement
Collapse
No announcement yet.
Stanley Meyer technology entering the age of the computer
Collapse
X
-
According to the ATMEL documentation, the Dragon can fully support the AT90CAN32.
If everything else fails, it could be a solution to replace the CAN128 with a CAN32. We still have lots of space for sub-system experiments.
The alternative is approx. 600$ for a JTAGICE mkII.
But first lets see what can be done, as you should not be able to program the CAN128 according to the doc. but maybe you can not program above the first 64KByte, as CAN64 programming is supported.
Compare the attached zip file (disguised as .pdf file), and compare the C::B project file with your own with a text editor or meld diff viewer, or another diff program.
Take a backup of your own project file in case you fail to correctly copy in the relevant lines from from my project file into yours using a text editor.
I use these commands for some of the steps:
Program the processor fuses with the command:
avarice -2 -r -B 125Khz -W eehhll -j usb ( ee extended fuse byte, hh high fuse byte, ll low fuse byte )
example
$ avarice -2 -P at90can128 -r -B 125Khz -W fd39ce -j usb
Flash the AVR program made by C::B with the command, use your own program name:
$ avarice -2 -P at90can128 -e -p -f can_io.bin -v -j usb
Debug the program, first starting avarice in one terminal and avr-gdb in another, or by post commands in C::B:
$ avarice -2 -P at90can128 -B 4Mhz -j usb localhost:4242
The commands above is for the JTAGICE mkII, change the -2 option to the Dragon option (avarice --help).
Good luck.
EricAttached Files
Comment
-
Hi tecstatic,
for the discrete components circuit I published at http://www.energeticforum.com/renewa...html#post75459 I want to add a connector to the pcb layout. trying to make the power drivers compatible to the discrete and to the uC driven solution there should be a common pin layout and connector design for the signals.
Do you have any details towards this subject?
and one more subject:
I have no idea how to test if the dragon can overcome the 32K limit. Any idea how I can test that without a large application program?
greetings,
bussi04Last edited by bussi04; 11-27-2009, 09:52 AM. Reason: added question towards memory limits for debugging
Comment
-
Not yet. maybe for the sake of easy change, we should just make the "connector board" on a standard raster test PCB, and do the connections from the uC main connectors to our interface connectors with wire wrap wire.Originally posted by bussi04 View PostHi tecstatic,
for the discrete components circuit I published at http://www.energeticforum.com/renewa...html#post75459 I want to add a connector to the pcb layout. trying to make the power drivers compatible to the discrete and to the uC driven solution there should be a common pin layout and connector design for the signals.
Do you have any details towards this subject?
But as your side is fixed on your PCB, I think we should first do the puzzle on the uC pin usage.
I have not started doing that, but will do that soon.
No, but you can try this ( I have not compiled it myself ):and one more subject:
I have no idea how to test if the dragon can overcome the 32K limit. Any idea how I can test that without a large application program?
greetings,
bussi04
The following is inserted in main.cpp, and it is the only file in the project.:
In your program you have 3300 lines with the numbers, please use your editor in a smart way to do thisCode:#include <avr/pgmspace.h> unsigned char large_array[ 33000 ] PROGMEM = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, . . 1, 2, 3, 4, 5, 6, 7, 8, 9, 20 // last line of record init }; int main() { short sum; // this is a single line comment sum = large_array[ 0 ] + large_array[ 32999 ]; sum = sum + 1; // can also be written as; sum += 1; return 1; }
Tip: use the line counter to check for the correct number of lines to make the compiler happy with the size of your record initialization.
The sum + 1 line is just to have a line to set a breakpoint, to check the sum is 21.
If this works the we probably have 64K available.
With more copy paste (or scripting), the same can be done around the 64KByte limit.
But even if we only have 32K available for debug with the Dragon, thats still a lot of program memory.
As long as we don't put in large engine parameter maps, I think we have more than we need.
Can you debug with C::B now ?
Eric
Comment
-
Originally posted by Tecstatic View Post...
No, but you can try this ( I have not compiled it myself ):
The following is inserted in main.cpp, and it is the only file in the project.:
In your program you have 3300 lines with the numbers, please use your editor in a smart way to do thisCode:#include <avr/pgmspace.h> unsigned char large_array[ 33000 ] PROGMEM = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, . . 1, 2, 3, 4, 5, 6, 7, 8, 9, 20 // last line of record init }; int main() { short sum; // this is a single line comment sum = large_array[ 0 ] + large_array[ 32999 ]; sum = sum + 1; // can also be written as; sum += 1; return 1; }
Tip: use the line counter to check for the correct number of lines to make the compiler happy with the size of your record initialization.
The sum + 1 line is just to have a line to set a breakpoint, to check the sum is 21.
If this works the we probably have 64K available.
With more copy paste (or scripting), the same can be done around the 64KByte limit.
But even if we only have 32K available for debug with the Dragon, thats still a lot of program memory.
As long as we don't put in large engine parameter maps, I think we have more than we need.
Can you debug with C::B now ?
Eric
Comment
-
bussi,
Regarding the compile error, first double check your array is the right size, do you have 1 line too much.
If the size is correct, then arrays can not be larger than 32KBytes, try split the data lines into 2 arrays;
Regarding the debug problems, I remember I also had to fiddle with the JTAGICE.Code:#include <avr/pgmspace.h> unsigned char large_array_0[ 16500 ] PROGMEM = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, . 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 // last line of record init }; unsigned char large_array_1[ 16500 ] PROGMEM = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, . 1, 2, 3, 4, 5, 6, 7, 8, 9, 20 // last line of record init }; int main() { short sum; // this is a single line comment sum = large_array_0[ 0 ] + large_array_1[ 16499 ]; sum = sum + 1; // can also be written as; sum += 1; return 1; }
Don't waste your time on this, let me have a look tomorrow, then I maybe remember the cause of the trouble (I solved it 2 years ago and don't remember the details right now).
Eric
Comment
-
bussi,
I forgot this question:
"Do you know the command syntax of "Additional Commands"?"
It is ordinary commands, e.g. objcopy or avarice.
Regarding debugging, you are almost done. I works for me, read on.
If the debugger does not close the connection so avarice exits, when ending the debug session, you must kill avarice manually.
You can not have two running avarice programs sharing the same port number.
I have debugged two AVRs simultaneously with two two screens on the same PC with 2 C::B programs, each being connected to its own instance of avarice.
The two running avarice programs then of cause have their own unique port number.
-----------------
In C::B click Settings->Compiler and debugger
Click in left pane "Debugger settings"
Remove the check mark from "Auto build project to ensure up-to-date"
Click "OK"
Insert a a character in you main file and erase it again to "touch" the file, so build will start compiling.
Then in the "build log" you will probably see an error when trying to download the program. Please post if download of the program works for you.
From the command window (not in C::B) issue the command below, if it did not work inside C::B:
$ avarice -g -P at90can128 -e -p -v -f your_file_name.bin -v -j usb
That should work OK.
Then issue the command:
$ avarice -g -P at90can32 -B 4Mhz -j usb localhost:4242
So avarice listens for commands at port 4242 with device 1t90can32.
In C::B click the "Debug / continue" button.
And you should see the yellow arrow pointing at the first code line in your main program.
I tested that step, toggle breakpoint, continue and watch variable works OK.
When I continue the program stops at the breakpoint.
I will not spend more time testing. I assume this will work at least until we cross the 32K barrier.
With my JTAGICE and my JTAGICE mkII the program download works OK from within C::B.
This seems not to be the case for the Dragon, where we must program in the external command window.
So this takes two up-arrows and an enter key to do manually in the command window.
Not much of a problem if you can save approx. 240$ buying the Dragon instead of the JTAGICE mkII.
Let me hear what you find.
Eric
Comment
-
Complete success debugging in CodeBlocks
It also worked for the large array-program!
Thanks so much for your support
.
The only command I had to add to put the debugger in line was "break main" in "Additional commands".
Ready for takeoff ...
bussi04
Comment
-
bussi,
Nice to hear, then you are ready to develop for the AVR uC.
However we have to do the same with wxWidgets on the PC only.
I have just started to write the driver for the LCD display.
The driver is put in a class. In C++ a class is like a struct in C, with the addition of code also.
The class has several properties we will see gradually. One property is its interface which is defined in a .h file which is included in the corresponding .cpp file, which implements the functionality of the interface.
The LCD driver class when ready, can be replaced with another class sharing the same .h interface, when the target is the PC.
Then we can simulate the LCD on the PC screen.
Adding buttons to the simulation, we can simulate the buttons on my new SUI PCB (Simple User Interface).
This way we can make the "whole" menu programming to select an application, and then adjust the parameters without running the program on the AVR. This is a development time saver.
Besides that, everyone with a PC, who follows the instructions in this thread can also do this without investing a single $, as all is free SW, no invoice
This way everyone of you readers can learn the skills to do more advanced timing for your experiments.
Bussi, in case you have some spare time, download the data sheet for the AT90CAN128 and read the port and timer sections.
----
Application of ports and timers fetched from this page:
Atmel Products - Application Notes
---
This design note is nice for general tips when making PCB layouts:
--------------------
Regarding the connectors let me suggest the following pin-out for the interface:
The VIC connector is a 10 pin header like the JTAG connector on the AVR-CAN.
Pin 1 Pulse, logic control signal for the switch transistor.
Pin 2 Sres1 The signal is clipped on the VIC PCB to reduce noise on the controller.
Pin 3 Sres2 The signal is clipped on the VIC PCB to reduce noise on the controller.
Pin 4 reserved ( NC )
Pin 5 VSAnalog, measured analog supply voltage scaled to 0..5V.
Pin 6 reserved ( NC)
Pin 7 VAnalog, Analog control value 0..5V controls the VIC supply voltage
Pin 8 SAmp, Analog value represented VIC primary current by a scaled voltage 0..5V
Pin 9 GND
Pin10 VCC, logic supply for the VIC logic and analog circuits
We have no ordinary connector for the EEC, as this will be a plastic fiber connection, when we identify a communication fiber link with suitable specs.
bussi, do you agree with the connector suggestion ?
Eric
Comment
-
Originally posted by Tecstatic View Post...
Regarding the connectors let me suggest the following pin-out for the interface:
The VIC connector is a 10 pin header like the JTAG connector on the AVR-CAN.
Pin 1 Pulse, logic control signal for the switch transistor.
Pin 2 Sres1 The signal is clipped on the VIC PCB to reduce noise on the controller.
Pin 3 Sres2 The signal is clipped on the VIC PCB to reduce noise on the controller.
Pin 4 reserved ( NC )
Pin 5 VSAnalog, measured analog supply voltage scaled to 0..5V.
Pin 6 reserved ( NC)
Pin 7 VAnalog, Analog control value 0..5V controls the VIC supply voltage
Pin 8 SAmp, Analog value represented VIC primary current by a scaled voltage 0..5V
Pin 9 GND
Pin10 VCC, logic supply for the VIC logic and analog circuits
We have no ordinary connector for the EEC, as this will be a plastic fiber connection, when we identify a communication fiber link with suitable specs.
bussi, do you agree with the connector suggestion ?
Eric
Comment
-
bussi,
Thank you for the feedback testing the Dragons capabilities.
Do you program the uC from within C::B or do you use the command window for programming ?
If so could you please send me the magic words to make it work.
Programming the uC from within C::B does not work for me for the Dragon, it does work for the JTAGICE.
---
You can find instructions on the net how to install wxWidget on windows to develop user applications.
You install libraries and header files.
When you get the sui.cpb C::B project file, then your installation should be ready to do wxWidgets user interface development.
Eric
Comment

.
Comment