SPI

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi!

Im kinda green to this. I've done some projects in asm in school but it was kinda basic and the microcontroller was already in place on a dev. kit. :/

Im working on a project where the microcontroller got a programming interface made via an J2 connector on the PCB, the pin setting is in the table below. I've downloaded Avr Studio 4 and do now want to load my asm into the microcontroller. What kinda of spi-device do I need to buy and what settigs do I need to use in Avr studio to download it?

I dont need help with the programming, only the "hardware" :roll:

Programming and Debug connector J2 pin out
Pin 1 VCC
Pin 2 MOSI
Pin 3 RESET or DW
Pin 4 MISO
Pin 5 GND
Pin 6 SKC

oao

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Academy section is for finished projects only.
Please read the guidelines in the top of the fora.

I will move this thread to the general AVR forum.

Plons
moderator

A GIF is worth a thousend words   They are called Rosa, Sylvia, Tricia, and Ulyana. You can find them https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Buy an Atmel AVRISP mkII. If you want debugging capabilities buy an Atmel Dragon, or if you've got some money to spend a JTAGmkII. If you have some serious money to spend a AVRone!.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I want to use matlab to send data to the µCont. I've dont this before and I used something lika the quoted code below. I intend to send up to 10 different values that is going to be stored on the EEPROM. (Done it before so how hard can it be :P)
To the question! Are there a cable wich goes from the serialport of my computer to the j2 on hte PCB?

Quote:
Sending Data
Before accessing the serial port, it must be initialized through MATLAB. This is done with
this code:
% Set serial port mode
!mode com2:38400,n,8,1
which sets the port to all of neccesary parameters. The port is still not open for writing,
however it is now in the correct mode. To open the port, the fopen command is used, which
returns a file descriptor to the port:
% open com port for data transfer
fid = fopen('com2:','w');
'com2:' is the port on the PC, 'w' means that we are opening the port for writing, and fid is the
file descriptor. For our purposes, you can think of the file descriptor as the port buffer itself,
and when you write to it, you are writing directly to the buffer. To write to the serial port
buffer, the fwrite command is used:
fwrite(fid,data,'int8');
data is the data to send to the port, fid is the file descriptor of the open port, and 'int8' is the
type of data being sent. For a list of different data types, check MATLAB help files with help
serial. Since the DSP is blind to the different types and we can only use 8 bits at a time, int8
should work.
Before finishing a function, or before executing a read from the serial port, the port MUST
BE CLOSED. Failure to close the port, will result in blocking access to other functions and
apps on the machine that need to use the port. A reset pulse is sent before closing. The port is
closed with the fclose command:
% send reset pulse
fwrite(fid,255,'int8');
% close com port connection
fclose(fid);
It seems intuitive that to read from the port, it need to be opened with a 'r' or a 'r+' instead of
'w'. According to the MATLAB help files this is true, but in practice it does not work. See the
next section for information on how to read from the serial port. Another method of opening
the port is using the fid = serial('com2'); command. This does not seem to work for
reading either. See the MATLAB help for more details and methods.

Im a sucker when it comes to cables and such. I like programming not the stuff behinde. :P