Justin Reina Posted April 12, 2009 Report Share Posted April 12, 2009 Hey jmt6009, Here is how to get AVR Studio up and running, (1) Install WinAVR: http://sourceforge.net/project/showfiles.p...ackage_id=66543 *Download the '-install.exe' file (2) Install AVR Studio: http://www.atmel.com/forms/software_downlo...dio416Setup.exe *Fill Out Registration (3) Install MkII Driver *Plug In mkII *Go through Auto-install sequence from Windows (4) Plug mkII into your devboard's ISP *Manual: http://www.atmel.com/dyn/resources/prod_do...RISPmkII_UG.pdf *Don't Proceed until the micrcontroller LED goes from red to green *If it is red, check your wiring and setup. this part might not be fun (4) Open AVR Studio *For now don't open a project (*.aps file), so hit cancel at the main dialogue *Open the Programmer Window (see openProgrammer.jpg) *Check for device (see checkDevice1.jpg & checkDevice2.jpg) *Set Correct Clock Fuse Bits (see setCorrectClockFusebits.jpg) *Uncheck the clock divide fuse (see uncheckClkDivide.jpg) *Make sure to hit program after making fuse changes (5) Load the binary file (the *.hex file) *Try the togglePins.hex first (see program.jpg) *This is the 'code' that runs on the uC (6) Hopefully it works *Work through the examples. They should get you up and running. @all: Here is previous thread: http://forums.lavag.org/Using-the-USB-6008...I-O-t13671.html Best of Luck, -Justin *All the Atmel code and LabVIEW code is in the zip file Quote Link to comment
jmtj6009 Posted April 12, 2009 Report Share Posted April 12, 2009 Justin, Thanks so much! I'm back home for the weekend, and I have an interview out in California Monday, but as soon as i get to my lab at school on Tuesday I'll work through all of this. . Just a quick question, i remembered having a problem connecting the 6 pin programmer to the 10 pin slot on the dev board. Is there simple way to wire this together? Thanks again! I'll post some videos as soon as I get everything running -Jim Quote Link to comment
Justin Reina Posted April 13, 2009 Author Report Share Posted April 13, 2009 Just found this nifty guy online ($4 for an ISP 6-10 adapter) http://www.nkcelectronics.com/avr-isp-prog...t-10-to-6-.html This might be the easiest option if you feel so inclined. Best of Luck, -Justin Oops the genders are backwards on that board nevermind.... but you get the jist of it. -Justin *Have a lab tech help out with making this adapter. Chances are he's got the parts ($.50 parts) and it would take him two seconds) Quote Link to comment
jmtj6009 Posted April 17, 2009 Report Share Posted April 17, 2009 Justin, I attached a wiring diagram and a flow chart, does this make sense to you? I don't have specs for the splitter I'm going to use, but i will shortly. It's pretty rough, but just wanted to give you an idea of how I'm setting this up. -Jim * also saw in your profile that you go to UofW ... lol, had to put something in to cite you Quote Link to comment
Justin Reina Posted April 18, 2009 Author Report Share Posted April 18, 2009 Hey jmt6009, I'll get back to you Sat morn. School's kinda busy till then. With regards to ISP connection, that's why I was saying its not fun cause it either works, or it doesn't. Two things to help: (1): There is a troubleshooting guide in ISP the manual. P.27 may be helpful. (2): Get a DMM that does the 'beepie' connectivity status. Use it to confirm pin locations. Like I said though, this is the lame part, cause its hard to troubleshoot. The ISP is a snap though once this stage is over. Talk to you Sat., -Justin *What school are you at? Quote Link to comment
jmtj6009 Posted April 18, 2009 Report Share Posted April 18, 2009 Justin, Sound great, actually... Saturday will be a huge work day for me (working on the design project all day) so i'll probably ask you a question or two... lol. I'm a Mech. Engineer major at The Catholic University of America in D.C. and next year I'll be doing my Masters at the Naval Postgraduate School in Astronautical Engineering . -jim * Over at NPS, they use simulink instead of LabView.. , I'll have to try and persuade them otherwise. Quote Link to comment
Justin Reina Posted April 18, 2009 Author Report Share Posted April 18, 2009 Hey jmt6009, In my opinion, Simulink is generally a better mechanical engineering tool set. LabVIEW generally involves systems that rely either on- a) a lot of electronics/compSci or b) a lot of expensive (but worth it ) NI hardware Go with the simulink, its generally better served for the mechanical engineering stuff. Plus bosses never recognize or appreciate LabVIEW block diagrams, but they always seem to gawk at a nice Simulink model. A quick side note to this opinion: ME 'mechatronics'-type courses that teach with packaged boards (i.e. everything is bolted, soldered and buffered by some slaving TA), these courses have No business using MATLAB to control hardware. If they disagree, ask them how truly 'convenient' it was to go with the MATLAB in the first place. Also ask them how much they are really teaching their students about the hardware they're controlling. Typically this decision is made out of a lack of product awareness, and the students suffer as a consequence. Just my two cents. -Justin *Awesome Side-Topic: LabVIEW-Solidworks Mechatronics toolset!!!! http://zone.ni.com/devzone/cda/tut/p/id/6183 - It is in Alpha right now, so its a free download. what will they think of next... Tell your friends! Quote Link to comment
jmtj6009 Posted April 19, 2009 Report Share Posted April 19, 2009 Justin, I'm trying to set up the programmer, but i keep getting an error STK500II, there seems to be a short circuit on the ISP connector, MOSI and SCK lines seemed to be short circuited. Should i just keep going at it and trying to fix the wiring, or is this a common error? *** Whoops, swtiched some wires, now it's blinking orange.. * ha, this will become an hourly update... Fixed it.. no more blinky orange. * Ugh, can't read the flash from the chip in AVR? The led is solid orange. * Okay, got the progammer to work. Reads and Writes the flash memory just fine (had to fix the ISP freq, and it worked.) So... now what do i do? lol. -Jim Quote Link to comment
Justin Reina Posted April 19, 2009 Author Report Share Posted April 19, 2009 Success!! I am glad to hear you got the ISP hooked up. That part can be very stubborn (but is smooth-sailing afterwards). Now onto the trials. Try trial one, I've precompiled the .hex file for you (for a 324P @8MHz). Use the AVR ISP window and load it into the flash, then check if it toggles the pins on port A (it should ). Let me know how it works out. -Justin Quote Link to comment
jmtj6009 Posted April 19, 2009 Report Share Posted April 19, 2009 justin, Ya, i was pretty excited to see all of the ...OK! responses from AVR after all of the ...FAILED! and red/orange blinking lights lol. So, should i just take out the oscilloscope and check the pins to see if they are sending V signals on and off? -Jim Quote Link to comment
Justin Reina Posted April 19, 2009 Author Report Share Posted April 19, 2009 Yes sir, the oscope is a man's best friend. take a peek with it. -Justin *The 'OK!' line is indeed a pretty satisfying reward. Quote Link to comment
jmtj6009 Posted April 19, 2009 Report Share Posted April 19, 2009 justin, it seems to be working, going on from 0 to 5.05V, Using a voltmeter though, the oscilloscope is MIA . -Jim Quote Link to comment
Justin Reina Posted April 19, 2009 Author Report Share Posted April 19, 2009 Cool, Now try Trial 2. It is a USART trial, so hook it up to a PC with a serial cable. Use the PWM Interface, and it should read out stuff. Let me know how it goes. -Justin Quote Link to comment
jmtj6009 Posted April 20, 2009 Report Share Posted April 20, 2009 justin, someone is being sneaky and snaggin my stuff. I gotta head up to the EE dept tomorrow afternnon when they're around and see if they grabbed my serial cable, and my scope. Supposing part 2 works out, after that i should set up the PWM run? -Jim Quote Link to comment
Justin Reina Posted April 20, 2009 Author Report Share Posted April 20, 2009 my advice: break their fingers yep. trial three interfaces with the labview panel and sets the first two PWM lines (OC0A and OC0B). I'll get the OC1-2 A/B up later. -Justin Quote Link to comment
jmtj6009 Posted April 21, 2009 Report Share Posted April 21, 2009 Justin, So I've come to realize after opening up the computer that was given to us by the company who made our Radar, that the serial port on the back isn't actually connected to anything! So, do you think it would be possible to get a serial to USB cable and use that for the board? Would there be some issues with the program or would it still work okay. -Jim * I definately broke some fingers btw edit: i dug deeper and pulled out the motherboard... Got the serial port. NVM crisis adverted. The guys who put the computer together just decided to not connect the serial port on the back of the case to the one deep in the box. Quote Link to comment
jmtj6009 Posted April 21, 2009 Report Share Posted April 21, 2009 Justin, So i tried the test 2. I programmed the chip, connected the serial cable, and ran labview. I wasn't receiving anything in the inbox. Should I have taken any other steps other than simply programming, plugging, and hitting go? Also, i took a shot at the third test. My scope showed the squarewave (with some overshoot, that shouln't be a problem should it?) but i wasn't able to manipulate it with labview. Perhaps there is a problem with the serial? -Jim * Also, after going through some of my system settings, i noticed that the bits/s on the com1 port can't be set to 56000 like you have in the code/labview. Its currently set at 9600, and the closest to 56000 is 57600.... could that be an issue? Quote Link to comment
Justin Reina Posted April 21, 2009 Author Report Share Posted April 21, 2009 Hey Jim, Serial Adapter ($7) : http://www.newegg.com/Product/Product.aspx...N82E16812156003 *Drivers and Manual are at sabrent.com. I have used it extensively, it works well. A Few Notes (1) 56000 should work, it is a standard rate. If it isn't for some reason, go into the project file and change the baud to 9600. then recompile the hex file and use that for your chip. http://digital.ni.com/public.nsf/allkb/D37...6256706005B9BE7 (2) I checked and the board is setup for a standard rs232 connection. Check that you do not have a 'null' serial cable. To check this, confirm connectivity with the dmm between 'Pin2' on both ends of your cable. If there is connection it is a standard cable(this is good). If not, then pin2 on one side connects to pin3 on the other (nullmodem, not the right cable ) http://en.wikipedia.org/wiki/Null_modem (3) A wiring schematic for your devboard is on sparkfun. this may help in your debugging. In the doc, they mention an rs232 'jumper' J1. Confirm that the TXD0 line on your chip (TXD0, or PD1) is wired to the rx pin on the RS232 chip (see attached). the pin is called 'rx' on the chip with respect to the host pc (i.e. the host pc receives on this line. ) http://www.sparkfun.com/datasheets/AVR/avr-p40b-8535.pdf (4) Trial_3 will not work if Trial_2 does not work. your prob is in Trial_2. (5) The overshoot is most certainly from an uncalibrated scope probe. http://oscilloscope-tutorials.com/oscilloscope/Setting.asp*Go to 'Compensating the Probe' With regards to the code not working, try the following steps:(1) Check that the 'tx' pin on the chip actually sends out a digital signal. if not the code is wrong . But this shouldn't be the case. (2) Check that your computers serial port works. on the serial cable, put a wire from pin2 to pin3 (i.e. connect rx to tx). with this configuration, your computer is sending to itself. Try a labview script that outputs some string. If your computer is working correctly, it should receive the same string. Best of Luck and keep me posted, -Justin Quote Link to comment
jmtj6009 Posted April 22, 2009 Report Share Posted April 22, 2009 Justin, I just ran a check to see if my serial port is working, and it does. I did a simple read and write from labview by shorting the pins on the cable and it worked. Hmm... the code labview used had a rate of 9600. I edited the code in AVR studio, and built the new .hex file but nothing. I'm wonedering, should i be connecting any of the serial ports ( the tx or rx) to the main chip? Right now there is no wiring on my board other than my modified 6 to 10 pin adapter. -Jim Quote Link to comment
Justin Reina Posted April 22, 2009 Author Report Share Posted April 22, 2009 Hey Jim, So you confirmed a digital signal generated on PD0? Also quick side note, always talk about software/hardware and/or any equipment/tools as such, as a tool. 'labview' didn't set your serial port to 9600 . Best of Luck -Justin Quote Link to comment
jmtj6009 Posted April 22, 2009 Report Share Posted April 22, 2009 justin, whoops, was i supposed to wire PDO to the RX from the serial chip? and the same with Tx? -Jim Quote Link to comment
Justin Reina Posted April 22, 2009 Author Report Share Posted April 22, 2009 hey Jim, You shouldn't have to do any wiring, or so I thought... Are the Rx and Tx pins on the RS232 chip connected to anything on your Atmega chip? -Justin Quote Link to comment
jmtj6009 Posted April 22, 2009 Report Share Posted April 22, 2009 justin, they weren't. i was about connect them to their respective pins on the atmega chip. Also, I re-compiled it to 56000 just to make sure im not messing with anything. Still not getting anything -Jim *also, not seeing anything on PD0 Quote Link to comment
Justin Reina Posted April 22, 2009 Author Report Share Posted April 22, 2009 no aim, sorry . gmail chat though. shoot! i said PD0 but I meant PD1 (PD1 is the TX0 line). my bad on that one, typed it up too quick. is there an output on TX0 as seen with an oscope? -Justin gmail chat: justinmreina@gmail.com Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.