Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

ATmega32m1
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> AVR
View previous topic :: View next topic  
Author Message
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5098
Location: Holland

blank.gif
PostPosted: Fri Apr 20, 2012 11:40 pm    Post subject: Reply with quote

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
View user's profile Visit poster's website
jgsparks

Bascom Member



Joined: 25 May 2007
Posts: 19

usa.gif
PostPosted: Sat Apr 21, 2012 7:10 pm    Post subject: Reply with quote

Well, Peter, there's the answer. Problem resolved!
Back to top
View user's profile
Plons

Bascom Member



Joined: 24 May 2005
Posts: 434
Location: Hilversum - The Netherlands

netherlands.gif
PostPosted: Tue Apr 24, 2012 3:36 am    Post subject: Reply with quote

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.1
ProtectedParallelPortProgrammingDongle: http://www.aplomb.nl/TechStuff/PPPD/PPPD%20English.html
Dragon-lair: http://www.aplomb.nl/TechStuff/Dragon/Dragon.html
"leef met vlag en wimpel, maar hou het simpel"
Back to top
View user's profile
jgsparks

Bascom Member



Joined: 25 May 2007
Posts: 19

usa.gif
PostPosted: Tue Apr 24, 2012 3:49 pm    Post subject: Reply with quote

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
View user's profile
Plons

Bascom Member



Joined: 24 May 2005
Posts: 434
Location: Hilversum - The Netherlands

netherlands.gif
PostPosted: Tue Apr 24, 2012 5:14 pm    Post subject: Reply with quote

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 Smile

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
Code:
MEGAPAGE=7

Where m32def.dat it says
Code:
MEGAPAGE=6

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.1
ProtectedParallelPortProgrammingDongle: http://www.aplomb.nl/TechStuff/PPPD/PPPD%20English.html
Dragon-lair: http://www.aplomb.nl/TechStuff/Dragon/Dragon.html
"leef met vlag en wimpel, maar hou het simpel"
Back to top
View user's profile
jgsparks

Bascom Member



Joined: 25 May 2007
Posts: 19

usa.gif
PostPosted: Tue Apr 24, 2012 10:39 pm    Post subject: Reply with quote

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
View user's profile
Plons

Bascom Member



Joined: 24 May 2005
Posts: 434
Location: Hilversum - The Netherlands

netherlands.gif
PostPosted: Wed Apr 25, 2012 12:14 am    Post subject: Reply with quote

Glad that the problem is solved. Would you be so kind to inform Mark Alberts about this ?

Cheers and happy programming Smile

Nard

_________________
Bascom AVR ver 2.0.8.1
ProtectedParallelPortProgrammingDongle: http://www.aplomb.nl/TechStuff/PPPD/PPPD%20English.html
Dragon-lair: http://www.aplomb.nl/TechStuff/Dragon/Dragon.html
"leef met vlag en wimpel, maar hou het simpel"
Back to top
View user's profile
jgsparks

Bascom Member



Joined: 25 May 2007
Posts: 19

usa.gif
PostPosted: Wed Apr 25, 2012 12:47 am    Post subject: Reply with quote

Done, thanks again!

Gary
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5098
Location: Holland

blank.gif
PostPosted: Wed Apr 25, 2012 9:18 am    Post subject: Reply with quote

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
View user's profile Visit poster's website
mlcarter

Bascom Member



Joined: 12 May 2009
Posts: 11

newzealand.gif
PostPosted: Tue Apr 09, 2013 4:15 am    Post subject: Reply with quote

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
View user's profile
jgsparks

Bascom Member



Joined: 25 May 2007
Posts: 19

usa.gif
PostPosted: Tue Apr 09, 2013 6:52 pm    Post subject: Reply with quote

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
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5098
Location: Holland

blank.gif
PostPosted: Tue Apr 09, 2013 8:46 pm    Post subject: Reply with quote

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
View user's profile Visit poster's website
PeterM

Bascom Member



Joined: 09 Jun 2008
Posts: 118

australia.gif
PostPosted: Wed Apr 10, 2013 12:41 am    Post subject: Reply with quote

I have bought many OBDII cables in the past from here
http://www.obd2cables.com/products/obd-cables/

_________________
Peter
Back to top
View user's profile
Paulvk

Bascom Member



Joined: 28 Jul 2006
Posts: 1198
Location: SYDNEY

australia.gif
PostPosted: Wed Apr 10, 2013 3:13 am    Post subject: Reply with quote

I just got a device similar to this http://dx.com/p/obdii-bluetooth-car-diagnostic-cable-black-blue-orange-dc-12v-42825 you can get an android app to read the ECU so even your smart phone will do Note when I got my chevy suburban 14 years ago it cost me $700 just to get an RS232 interface with a program!
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5098
Location: Holland

blank.gif
PostPosted: Wed Apr 10, 2013 9:34 am    Post subject: Reply with quote

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
View user's profile Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> AVR All times are GMT + 1 Hour
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum