View previous topic :: View next topic |
Author |
Message |
albertsm
Joined: 09 Apr 2004 Posts: 5920 Location: Holland
|
Posted: Fri Apr 20, 2012 11:40 pm Post subject: |
|
|
If you use the free demo, the changes are low you get an answer. when there is a compiler problem we will check/fix it. And at random we also answer questions from demo users. but questions related to hardware where we must take time to connect hardware will get a low priority. there are million different programmers on line which you can build for little. so this problem is not flagged as a 'show stopper'. _________________ Mark |
|
Back to top |
|
|
jgsparks
Joined: 25 May 2007 Posts: 19
|
Posted: Sat Apr 21, 2012 7:10 pm Post subject: |
|
|
Well, Peter, there's the answer. Problem resolved! |
|
Back to top |
|
|
Plons
Joined: 24 May 2005 Posts: 435 Location: Hilversum - The Netherlands
|
Posted: Tue Apr 24, 2012 3:36 am Post subject: |
|
|
O dear, o dear, another victim of the STK200 programmer. It never ends.
I wrote a webpage about it: see my signature.
To modify an existing STK200 dongle: add R14 and C3 to the SCK-line. That will probably be sufficient. But do it on the STK200 dongle PCB. _________________ Bascom AVR ver 2.0.8.6
Dragon-lair: http://www.aplomb.nl/TechStuff/Dragon/Dragon.html
"leef met vlag en wimpel, maar hou het simpel" |
|
Back to top |
|
|
jgsparks
Joined: 25 May 2007 Posts: 19
|
Posted: Tue Apr 24, 2012 3:49 pm Post subject: |
|
|
Greetings Plons,
Nice to meet you! I have previously read your posts to avrfreaks and also had previously consulted the page on your website which you reference at the bottom of your posting. Thank you for your work in general!
In specific: I in fact built my "STK200-like" programmer from the idea on your website originally. There are some changes which I would like to describe. It has been several years since I built it, so I am a bit fuzzy why I made the changes. The first changes have to do with the filter from the 74HC244 to MOSI, SCR, MISO. There I used the 330ohm, 330pf. 330ohm values which I gleaned from the avrfreaks discussion, if I remember correctly. The final 330ohm resistors go right to the pins of the AVR chip. The RST line goes directly from pins 3, 5, and 7 of the 74HC244 to the RST of the AVR (no 56 ohm resistor as in your version). Also I am using the 3 x 10k ohm version of the BC547; I noted on your page the advisability of making the base resistor 2.2K ohm, but I haven't done that. In my frustration about getting the chip working, I thought something might have gone wrong with my wiring of the programmer I had been using, so I built a second programmer. And the second programmer shows the same problems in programming. So I am fairly confident that I have not made a wiring error or that a cold solder joint popped up with the "STK200-like" programmer. Both programmers still, now, program all other chips I use without a problem.
What confuses me is that I have been using the homebrew programmer for years with never a problem. Could these slight deviations noted above be causing the problem I described at the outset of this thread with the ATmega32m1? And, if I recall correctly, the 330ohm, 330pf, 330ohm version of the filter was even recommended.
So, that is what I have done and am unclear why the difficulty would arise programming just this one type of chip. (I tried several ATmega32m1 chips, two versions of the programmer, tried them on two different computers.)
I solicit your thoughts.
Thanks,
Gary |
|
Back to top |
|
|
Plons
Joined: 24 May 2005 Posts: 435 Location: Hilversum - The Netherlands
|
Posted: Tue Apr 24, 2012 5:14 pm Post subject: |
|
|
Hi Gary,
Thanks for your kind words.
It started with 330 Ohm and 330pF in the ISP-lines. Reason to lower the resistor eventually has to do with target AVR's that may have circuitry on their SPI-pins. The value is a compromise. 470pF instead of 330pF is to not lower the RC-time too much. To keep the RC-time equal, 680pF would be the optimum, but I don't like that much capacitance on an I/O line.
If you connected the BC547 correctly, 3x 10k should work fine. But if you swapped collector and emittor, the version with 2k2 will work even in that case
Let's assume that the programmers are not the cause of this problem.
What is left ?
1. Is Avcc (pin19) within 0.3V from Vcc (pin4) ? What connects these two ? At what voltage runs your Mega32m1 ? Is there sufficient decoupling on the powerlines ? An electrolytic 10~100uF in parallel with a ceramic of 0.1uF is recommended. Are both Gnd-pins (pin5 and pin20) connected to ground ?
2. Are you using MOSI_A PD3 pin2 as MOSI for your programmer ? And MISO_A PD2 pin1 as MISO ? And SCK_A PD4 pin 12 as SCK ?
3. Is there a capacitor on the /Reset ? If so, remove it during development. Do you use PE0 pin 31 ?
4. Is it possible that you disabled the internal RC-oscillator accidently ? If unsure, take an AVR you *can* program and make it output a 1MHz on one of it's timer outputs and feed that into PE1 pin 10.
If this list of checkpoints doesn't work, it's time to post a picture of your setup.
And a schematic.
And your software.
Also check your m32M1.dat in the Bascom folder for the correct signature: DEVID=1E9584 ; DEVICE ID AT90CAN32. That "AT90CAN32" is heritage and should (of course) be ATmega32M1. But that's not a big deal. Mark needs to change that. Crucial is the DEVID=1E9584
Are you sure that you have the pin numbering correct ? TopView --> CCW
Checkout Ebay for USBASP. For a few dollar you can have one. Or, if you insist on making your own: www.fischl.de Splendid work by Thomas Fischl !
Edit:
I am a bit puzzled on what I find in the .dat-files (Bascom folder):
For the m32M1.dat it says
Where m32def.dat it says
And both say Code: | MEGAPROG=1 ; program with pages method |
Both 32 kB devices, so I would expect the same size for the MEGAPAGE
Give it a try and modify m32M1.dat . But don't forget to restore it .... unless this is the clue. _________________ Bascom AVR ver 2.0.8.6
Dragon-lair: http://www.aplomb.nl/TechStuff/Dragon/Dragon.html
"leef met vlag en wimpel, maar hou het simpel" |
|
Back to top |
|
|
jgsparks
Joined: 25 May 2007 Posts: 19
|
Posted: Tue Apr 24, 2012 10:39 pm Post subject: |
|
|
Plons,
YOU ARE A GENIUS!! YES, I'M SHOUTING (but in a good way!!). That solved the problem, and the chip now loads just fine! Per your idea I changed the MEGAPAGE=7 to MEGAPAGE=6 in m32M1.dat, and Voila!! Everything works as expected. I am so happy! I literally spent days trying to figure out what was wrong. And it was just a simple digit in the .dat file that needed attention. Merci beaucoup for your thoughtfulness and help.
Gary |
|
Back to top |
|
|
Plons
Joined: 24 May 2005 Posts: 435 Location: Hilversum - The Netherlands
|
Posted: Wed Apr 25, 2012 12:14 am Post subject: |
|
|
Glad that the problem is solved. Would you be so kind to inform Mark Alberts about this ?
Cheers and happy programming
Nard _________________ Bascom AVR ver 2.0.8.6
Dragon-lair: http://www.aplomb.nl/TechStuff/Dragon/Dragon.html
"leef met vlag en wimpel, maar hou het simpel" |
|
Back to top |
|
|
jgsparks
Joined: 25 May 2007 Posts: 19
|
Posted: Wed Apr 25, 2012 12:47 am Post subject: |
|
|
Done, thanks again!
Gary |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5920 Location: Holland
|
Posted: Wed Apr 25, 2012 9:18 am Post subject: |
|
|
thanks for informing me, i changed it. sorry about the dat file. because you had 2 problems and your initial problem was a hardware problem i did not follow the whole thread and was unaware about the new problem.
when you can read the ID it means communication is ok. when programming fails (but eeprom writing works) it is likely that the page size is incorrect. it happened to me too when implementing new chips. not all M32 chips have the same pagesize. The CAN has 128 and i probably derived from the CAN dat file. _________________ Mark |
|
Back to top |
|
|
mlcarter
Joined: 12 May 2009 Posts: 11
|
Posted: Tue Apr 09, 2013 4:15 am Post subject: |
|
|
Hello jgsparks,
thank you for sorting this I had this exact problem and you allowed me to fix in minutes instead of days!
I'm now attempting to get the CAN-Elektor.bas program to run but the COM2 and CANIT seem to be different from the M32CAN. I'm just being a bit cheeky and wondering if you could give me some pointers on getting a M32m1 program to run to monitor car/machinery CANBUS. Or a code spinet?
Thanks Mark |
|
Back to top |
|
|
jgsparks
Joined: 25 May 2007 Posts: 19
|
Posted: Tue Apr 09, 2013 6:52 pm Post subject: |
|
|
Greetings Mark,
I confess I'm pretty much a beginner here and have absolutely no idea how to answer your question. Sorry.
Gary |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5920 Location: Holland
|
Posted: Tue Apr 09, 2013 8:46 pm Post subject: |
|
|
i wanted to use CAN to monitor some data in my car but i could not find a good connector. where can one buy these?
to use can you need to set baud to 500 KB
then you can ask for data like RPM
you first need to define a MOB for sending the request. The ID is the PID_REQUEST which &H7DF
The data is 8 bytes.
ar(1) = &H02
ar(2) = &H01
ar(3)= pid ' this varies on what you want for example &H0C for RPM
ar(4)=0:ar(5)=0:ar(6)=0:ar(7)=0
after you send the message with cansend, you wait for the reply, so you need to define a mob for the answer as well.
the reply must have an ID of &H7E8
for the answer you check the PID so you know what to do with the data.
in case of RPM the rpm = ar(4) * 256
rpm=rpm+ar(5)
rpm=rpm/4 _________________ Mark |
|
Back to top |
|
|
PeterM
Joined: 09 Jun 2008 Posts: 118
|
|
Back to top |
|
|
Paulvk
Joined: 28 Jul 2006 Posts: 1257 Location: SYDNEY
|
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5920 Location: Holland
|
Posted: Wed Apr 10, 2013 9:34 am Post subject: |
|
|
thanks for the links. i only need the connector but when it has a cable it is no problem. i do have the bluetooth device, but that is not what i need when connecting a CAN chip. _________________ Mark |
|
Back to top |
|
|
|