How To make the Tempsens2 code running on HADSHOPOMO1 ================================================================================ 0) For run the tempsens2 application you will need the following files: -source files: tempsens2.c; OWIHighLevelFunctions.c; OWISWBitFunctions.c -Header files: OWIHighLevelFunctions.h; OWIBitFunctions.h; OWIPolled.h. -MakeFile: Makefile Is strongly raccomended to use the Makefile options. Please notice that since all the files have been modified from the originals provided by Atmel, the project will not run properly with the original files. All the files must be in the same directory of the Makefile. You will also need to have the serialtrx.c program running on the on-board processor, and the sockettcp.c program running on a server computer. 1) Connect the AVR ICEmkII debug device to the board's JTAG port. Please pay attention that both the board and the devices are turned on and powered. Therefore use an adapter from the SMD port of the board to a pin two row connector and the adapter (included with the AVR debug interface) from a set of single PINS to the 10pin JTAG pin connector of the debug and programming interface. Board Connector Pin 1: TMS --> blue cable (on the AVR adapter) Board Connector Pin 3: TDI --> red cable Board Connector Pin 5: VCC --> purple cable Board Connector Pin 7: TDO --> bright grey cable Board Connector Pin 9: TCK --> black cable Board Connector Pin 4: GND --> white cable Pin 1 on the MOMOPS board (Port next to the Atmel MPU): \-----------------/ \ x / \ / \-----------/ Pin 1 of the SMD to two row pin connector adapter is marked. 2) Open a shell, go to directory in which the files are stored, and run the "make debug" command. This will create a [name].elf file which can be ran on the microcontroller and will download it to the microcontroller. Please check that the Fuse Bytes of the microcontroller are setted to this values: 3) Go to the debugger with the command avr-gdbtui -x gdb_env [name].elf, for run the file. a window will open, and there will be a line saying the position of the "breakpoint" followed by a line number. If you want just the program to run, and don't want to do debugging, send the command "clear [line number]" where line number is the line where the breakpoint function is defined. Then send the command "c" (continue). 4) Run on the server computer, which has to be linked to the board via LAN connection, the sockettcp.c program. This program will only send a command to the processor on the board and receive back the data sent by the microcontroller. For run the program, when calling it from the shell you must define the number of the port dedicated to this work 5) the tempsens2.c program will wait for data (and will send data) to the USART register. So you have to run a program on the board processor for send and receive data through serial port. serialtrx.c challenge this feature. To use it, compile it with the Gnu Compiler (gcc) and move the executable to the Linux processor (the compiler on the Linux processor does not match all the needed features, so you can't use it). For run the executable you have to call in the shell command also the serial port used for the transmission (for example "/dev/ttyS1"), the IP address of the server and the port you choose on step 4. 5b) Alternatively to point 5, is possible to run "start_tempsens.sh". In this case the serial and the TCP port must be setted in "start_tempsens_in_etrax.sh". 6) now you should see on your server screen the data arriving ;-) 7) The datas are sent (and received) inthe format "n: 16hex 4hex" where n is a progressive number starting from 0 which simply counts the number of sensors; 16hex is the 16 numbers ID in hexadecimals; 4hex is the temperature read by the sensor in 4 hexadecimals numbers. If this number starts with an "F" is meant as a negative value. To get the decimal value in this case you should calculate the number (ffff - 4hex + 1), convert it in decimals and divide by 16. Connecting the wires to the HADSHOPOMO1 Board ================================================================================ The DS1820 needs 3 wires (but they can all be connected to the same wires). 1 is the ground, 1 is the power supply, 1 is the 1-wire bus. The ground wires have to be connected to a 3.3V power plaque (see photo gor_hadshopomo), the 1-Wire buses can be connected to pins 2; 3 or 4 of the JADC1, and a pullup resistor which has to provide a 3.3V potential must be linked to these pins. The power supply can't be given by the AT90CAN128, because its internal pullup resistor is not strong enough, so they have to be connected to a 3.3V plaque. The pin 1 of the devices must be plugged to the ground wire, pin 2 to the 1-wire bus and pin 3 to power supply. Dallas 1820 ------- |1 2 3| \ / \ / ---