Commit from enseirb on branch eirbot (2007-01-25 14:21 CET) ------------------------------------
Add unioc encoders to config aversive config/config.in 1.27.4.5 aversive config/generate_aversive_config 1.17.4.5 ------------------------- aversive/config/config.in (1.27.4.4 -> 1.27.4.5) ------------------------- *************** *** 261,267 **** dep_bool ' Create Default encoders_eirbot config' CONFIG_MODULE_ENCODERS_EIRBOT_CREATE_CONFIG \ $CONFIG_MODULE_ENCODERS_EIRBOT ! endmenu # (encoders) mainmenu_option next_comment comment 'Robot specific modules' --- 261,275 ---- dep_bool ' Create Default encoders_eirbot config' CONFIG_MODULE_ENCODERS_EIRBOT_CREATE_CONFIG \ $CONFIG_MODULE_ENCODERS_EIRBOT ! #### ENCODERS ! dep_bool 'Encoders (eirbot 2K7 UNIOC)' CONFIG_MODULE_ENCODERS_EIRBOT_2K7 \ ! $CONFIG_MODULE_UTILS \ ! $CONFIG_MODULE_WAIT \ ! ! dep_bool ' Create Default encoders_eirbot_2K7 config' CONFIG_MODULE_ENCODERS_EIRBOT_2K7_CREATE_CONFIG \ ! $CONFIG_MODULE_ENCODERS_EIRBOT_2K7 ! ! endmenu # (encoders ) mainmenu_option next_comment comment 'Robot specific modules' ---------------------------------------- aversive/config/generate_aversive_config (1.17.4.4 -> 1.17.4.5) ---------------------------------------- *************** *** 17,22 **** --- 17,23 ---- CONFIG_MODULE_MULTISERVO,devices/servo/multiservo CONFIG_MODULE_ENCODERS_MICROB,devices/encoders/encoders_microb CONFIG_MODULE_ENCODERS_EIRBOT,devices/encoders/encoders_eirbot + CONFIG_MODULE_ENCODERS_EIRBOT_2K7,devices/encoders/encoders_eirbot_2k7 CONFIG_MODULE_TRAJECTORY_MANAGER,devices/robot/trajectory_manager CONFIG_MODULE_CHECKPOINT,devices/robot/checkpoint CONFIG_MODULE_ROBOT_SYSTEM,devices/robot/robot_system Commit from enseirb on branch eirbot (2007-01-25 14:24 CET) ------------------------------------ Add unioc encoders + aversive modules/devices/encoders/encoders_eirbot_2k7/Makefile 1.1.2.1 + aversive modules/devices/encoders/encoders_eirbot_2k7/encoders_eirbot_2k7.c 1.1.2.1 + aversive modules/devices/encoders/encoders_eirbot_2k7/encoders_eirbot_2k7.h 1.1.2.1 -------------------------------------------------------------- aversive/modules/devices/encoders/encoders_eirbot_2k7/Makefile (1.1.2.1) -------------------------------------------------------------- *************** *** 0 **** --- 1,6 ---- + TARGET = encoders_eirbot_2k7 + + # List C source files here. (C dependencies are automatically generated.) + SRC = encoders_eirbot_2k7.c + + include $(AVERSIVE_DIR)/mk/aversive_module.mk --------------------------------------------------------------------------- aversive/modules/devices/encoders/encoders_eirbot_2k7/encoders_eirbot_2k7.c (1.1.2.1) --------------------------------------------------------------------------- *************** *** 0 **** --- 1,88 ---- + /* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: encoders_eirbot_2k7.c,v 1.1.2.1 2007-01-25 13:24:29 enseirb Exp $ + * + */ + + /** \file encoders_eirbot_2k7b.c + * \brief achieves acess to incremental encoders managed by a FPGA and accessed via external ram interface + * + * \todo nothing ! + * + * \test + * + * this modules reads 8 bit encoders values on an external interface. + * there are two necessary busses with the interface logic: 8 bit data bus and a n bits selection bus. + * ( see the VDHL for the xilinx program) + * with n bits on the selection bus, you can acess to 2^n encoderss. + * + * modifié par lamygale le 10 octobre 2005. d'apres le code 2004 du codeur + * + */ + + + + #include <utils.h> + + + #include "encoders_eirbot_2k7.h" + + #include "encoders_eirbot_2k7_config.h" + + /** + * fonction utilisée 2 fois seulement, acquiert un codeur + */ + inline int32_t get_encoder(uint8_t num) + { + int32_t val; + uint8_t *reg; + uint8_t flags; + + // calcul de l'adresse de base des 4 registres conservant la valeur codeur + reg = (uint16_t)BASE_ADRESS_ENCODERS + 4* num; + + IRQ_LOCK(flags); + // recuperation des 4 octets composant la valeur codeur + val = (int32_t)( ((*(reg +4))<<24) | ((*(reg +3))<<16) |((*(reg +1))<<8) | (*(reg +1)) ); + + IRQ_UNLOCK(flags); + + return val; + } + + /** Initialisation des codeurs, variables, et ports */ + void encoders_init(u08 config) + { + MCUCR = MCUCR | (1 << SRE); + ENCODERS_CONFIG = config; + } + + + /** Extraction d'une valeur de codeur */ + encoders encoders_get_value(uint8_t number) + { + encoders value; + uint8_t flags; + + IRQ_LOCK(flags); + value = get_encoder(number); + IRQ_UNLOCK(flags); + + return value; + } + --------------------------------------------------------------------------- aversive/modules/devices/encoders/encoders_eirbot_2k7/encoders_eirbot_2k7.h (1.1.2.1) --------------------------------------------------------------------------- *************** *** 0 **** --- 1,52 ---- + /* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: encoders_eirbot_2k7.h,v 1.1.2.1 2007-01-25 13:24:29 enseirb Exp $ + * + */ + + /** \file encoders_eirbot.h + * \brief universal Interface for incremental coders + */ + + #ifndef _ENCODERS_EIRBOT_2K7_H_ + #define _ENCODERS_EIRBOT_2K7_H_ + + #include <base/utils/utils.h> + #include <encoders_eirbot_2k7_config.h> + + + /** definition du registre interne au FPGA */ + #define ENCODERS_CONFIG _SFR_MEM8(BASE_ADRESS_ENCODERS) + + + typedef int32_t encoders; + + /** + * Initialisation of counters, variables + * Sets the encoders rotationwise : + * each byte of the data configures one encoder. + * refer to the encoders_eirbot_2k7_config_file + * to find the corresponding byte number of each encoder + */ + void encoders_init(uint8_t config); + + + /** Extract counter value from the FPGA*/ + encoders encoders_get_value(uint8_t number); + + #endif Commit from enseirb (2007-01-25 20:18 CET) ------------------- Add some unioc related tests + aversive_projects eirbot2007/unioc_codeurs/Makefile 1.1 + aversive_projects eirbot2007/unioc_codeurs/encoders_eirbot_2k7_config.h 1.1 + aversive_projects eirbot2007/unioc_codeurs/encoders_eirbot_config.h 1.1 + aversive_projects eirbot2007/unioc_codeurs/main.c 1.1 + aversive_projects eirbot2007/unioc_codeurs/scheduler_config.h 1.1 + aversive_projects eirbot2007/unioc_codeurs/uart_config.h 1.1 + aversive_projects eirbot2007/unioc_external_ram/Makefile 1.1 + aversive_projects eirbot2007/unioc_external_ram/error_config.h 1.1 + aversive_projects eirbot2007/unioc_external_ram/main.c 1.1 + aversive_projects eirbot2007/unioc_external_ram/uart_config.h 1.1 + aversive_projects eirbot2007/unioc_test_asserv/Makefile 1.1 + aversive_projects eirbot2007/unioc_test_asserv/encoders_eirbot_2k7_config.h 1.1 + aversive_projects eirbot2007/unioc_test_asserv/main.c 1.1 + aversive_projects eirbot2007/unioc_test_asserv/pwm_config.h 1.1 + aversive_projects eirbot2007/unioc_test_asserv/scheduler_config.h 1.1 + aversive_projects eirbot2007/unioc_test_asserv/uart_config.h 1.1 + aversive_projects eirbot2007/unioc_test_pwm/Makefile 1.1 + aversive_projects eirbot2007/unioc_test_pwm/main.c 1.1 + aversive_projects eirbot2007/unioc_test_pwm/pwm_config.h 1.1 + aversive_projects eirbot2007/unioc_test_pwm/scheduler_config.h 1.1 + aversive_projects eirbot2007/unioc_test_pwm/uart_config.h 1.1 + aversive_projects eirbot2007/unioc_test_pwm/utils_config.h 1.1 --------------------------------------------------- aversive_projects/eirbot2007/unioc_codeurs/Makefile (1.1) --------------------------------------------------- *************** *** 0 **** --- 1,21 ---- + TARGET = main + + # repertoire des modules + AVERSIVE_DIR = ../.. + + # List C source files here. (C dependencies are automatically generated.) + SRC = $(TARGET).c + + # List Assembler source files here. + # Make them always end in a capital .S. Files ending in a lowercase .s + # will not be considered source files but generated files (assembler + # output from the compiler), and will be deleted upon "make clean"! + # Even though the DOS/Win* filesystem matches both .s and .S the same, + # it will preserve the spelling of the filenames, and gcc itself does + # care about how the name is spelled on its command-line. + ASRC = + + ######################################## + + -include .aversive_conf + include $(AVERSIVE_DIR)/mk/aversive_project.mk ----------------------------------------------------------------------- aversive_projects/eirbot2007/unioc_codeurs/encoders_eirbot_2k7_config.h (1.1) ----------------------------------------------------------------------- *************** *** 0 **** --- 1,40 ---- + // EIRBOT 2005 + // ToF + /** \file codeur_config.h + * \brief configuration du module codeur + * + * \todo il reste a implémanter la version sur irq + * + * \test a tester en version xil + * + * on peut configurer ici combien de codeurs seront utilisés + * et comment y accéder (interface bus xilinx ou ports en irq) + */ + + #ifndef _COUNTER_EIRBOT_2K7_CONFIG_ + #define _COUNTER_EIRBOT_2K7_CONFIG_ + + #include <avr/io.h> + + /** adresse la plus basse à partir de laquelle se trouvent toutes les autres données codeur. + * Ceci implique des adresses consécutives pour les modules codeurs + * #define BASE_CODEUR 0x1200 + */ + + #define BASE_ADRESS_ENCODERS 0x1300 + + /** nombre de codeurs implantés dans le FPGA et utilisés par le µc + */ + #define ENCODERS_NUMBER 4 + + /** Registre ENCODERS_CONFIG : + * correspondance numero de bit, codeur + */ + #define L_ENGINE_ENCODER 0 + #define R_ENGINE_ENCODER 1 + #define L_SEPARATED_ENCODER 2 + #define R_SEPARATED_ENCODER 3 + + #endif + + ------------------------------------------------------------------- aversive_projects/eirbot2007/unioc_codeurs/encoders_eirbot_config.h (1.1) ------------------------------------------------------------------- *************** *** 0 **** --- 1,11 ---- + + #define ENCODERS_SEL_START_BIT 0 + #define ENCODERS_SEL_NB_BIT 3 + #define ENCODERS_SEL_DDR DDRA + #define ENCODERS_SEL_PORT PORTA + + #define ENCODERS_GET_START_BIT 0 + #define ENCODERS_GET_NB_BIT 8 + #define ENCODERS_GET_DDR DDRB + #define ENCODERS_GET_PIN PINB + ------------------------------------------------- aversive_projects/eirbot2007/unioc_codeurs/main.c (1.1) ------------------------------------------------- *************** *** 0 **** --- 1,61 ---- + /* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: main.c,v 1.1 2007-01-25 19:18:49 enseirb Exp $ + * + */ + + #include <stdlib.h> + #include <stdio.h> + #include <utils.h> + #include <wait.h> + #include <uart.h> + //#include <scheduler.h> + #include <encoders_eirbot_2k7.h> + + int main(void) + { + uint8_t i=0; + int32_t e0, e1, e2, e3; + + uart_init(); + + fdevopen((int(*)(char))uart0_send, + (int(*)(char))uart0_recv, + 0); + + encoders_init((1<<L_ENGINE_ENCODER) | (1 <<R_ENGINE_ENCODER)); + + sei(); + + /* add microb encoders management */ + //scheduler_add_periodical_event(encoders_microb_manage, NULL, 1); + + while(1) { + e0 = encoders_get_value(L_ENGINE_ENCODER); + e1 = encoders_get_value(R_ENGINE_ENCODER); + e2 = encoders_get_value(L_SEPARATED_ENCODER); + e3 = encoders_get_value(R_SEPARATED_ENCODER); + + printf("%.8ld %.8ld %.8ld %.8ld\r\n", e0, e1, e2, e3); + + wait_ms(100); + } + + return 0; + + } ------------------------------------------------------------- aversive_projects/eirbot2007/unioc_codeurs/scheduler_config.h (1.1) ------------------------------------------------------------- *************** *** 0 **** --- 1,29 ---- + /* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: scheduler_config.h,v 1.1 2007-01-25 19:18:49 enseirb Exp $ + * + */ + + #ifndef _SCHEDULER_CONFIG_H_ + #define _SCHEDULER_CONFIG_H_ + + + #define SCHEDULER_NB_MAX_EVENT 5 + #define SCHEDULER_CLOCK_PRESCALER 8 + + #endif // _SCHEDULER_CONFIG_H_ -------------------------------------------------------- aversive_projects/eirbot2007/unioc_codeurs/uart_config.h (1.1) -------------------------------------------------------- *************** *** 0 **** --- 1,72 ---- + /* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: uart_config.h,v 1.1 2007-01-25 19:18:49 enseirb Exp $ + * + */ + + /* Droids-corp 2004 - Zer0 + * config for uart module + */ + + #ifndef UART_CONFIG_H + #define UART_CONFIG_H + + /* + * UART0 definitions + */ + + /* compile uart0 fonctions, undefine it to pass compilation */ + #define UART0_COMPILE + + /* enable uart0 if == 1, disable if == 0 */ + #define UART0_ENABLED 1 + + /* enable uart0 interrupts if == 1, disable if == 0 */ + #define UART0_INTERRUPT_ENABLED 1 + + #define UART0_BAUDRATE 38400 + + /* + * if you enable this, the maximum baudrate you can reach is + * higher, but the precision is lower. + */ + #define UART0_USE_DOUBLE_SPEED 0 + //#define UART0_USE_DOUBLE_SPEED 1 + + #define UART0_RX_FIFO_SIZE 4 + #define UART0_TX_FIFO_SIZE 4 + //#define UART0_NBITS 5 + //#define UART0_NBITS 6 + //#define UART0_NBITS 7 + #define UART0_NBITS 8 + //#define UART0_NBITS 9 + + #define UART0_PARITY UART_PARTITY_NONE + //#define UART0_PARITY UART_PARTITY_ODD + //#define UART0_PARITY UART_PARTITY_EVEN + + #define UART0_STOP_BIT UART_STOP_BITS_1 + //#define UART0_STOP_BIT UART_STOP_BITS_2 + + + + + /* .... same for uart 1, 2, 3 ... */ + + #endif + -------------------------------------------------------- aversive_projects/eirbot2007/unioc_external_ram/Makefile (1.1) -------------------------------------------------------- *************** *** 0 **** --- 1,21 ---- + TARGET = main + + # repertoire des modules + AVERSIVE_DIR =../..# VALUE, absolute or relative path : example ../.. # + + # List C source files here. (C dependencies are automatically generated.) + SRC = $(TARGET).c + + # List Assembler source files here. + # Make them always end in a capital .S. Files ending in a lowercase .s + # will not be considered source files but generated files (assembler + # output from the compiler), and will be deleted upon "make clean"! + # Even though the DOS/Win* filesystem matches both .s and .S the same, + # it will preserve the spelling of the filenames, and gcc itself does + # care about how the name is spelled on its command-line. + ASRC = + + ######################################## + + -include .aversive_conf + include $(AVERSIVE_DIR)/mk/aversive_project.mk -------------------------------------------------------------- aversive_projects/eirbot2007/unioc_external_ram/error_config.h (1.1) -------------------------------------------------------------- *************** *** 0 **** --- 1,31 ---- + /* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: error_config.h,v 1.1 2007-01-25 19:18:49 enseirb Exp $ + * + */ + + #ifndef _ERROR_CONFIG_ + #define _ERROR_CONFIG_ + + /** enable the dump of the comment */ + #define ERROR_DUMP_TEXTLOG + + /** enable the dump of filename and line number */ + #define ERROR_DUMP_FILE_LINE + + #endif ------------------------------------------------------ aversive_projects/eirbot2007/unioc_external_ram/main.c (1.1) ------------------------------------------------------ *************** *** 0 **** --- 1,59 ---- + #include <avr/io.h> + #include <wait.h> + //#include <uart.h> + + //#include<stdio.h> + + #define REG_FPGA _SFR_MEM8(0x13E0) + //(volatile unsigned char*)( 0x1299 ) + + + int main(void) + { + //u08 *data = 0x1299; + + //data = 0xDD99; + + /* + DDRC = 0xFF; + DDRE = 0xFF; + DDRA = 0xFF; + DDRG = 0x07; + */ + MCUCR = 1 << SRE; + + while(1) { + /* + data++; + + if (data = 0x2000) + data = 1299; + */ + // *data = 0xAA; + REG_FPGA = 0x01; + wait_ms(2000); + // *data = 0x55; + REG_FPGA = 0x02; + wait_ms(2000); + + REG_FPGA = 0x07; + wait_ms(2000); + + + + + /* //REG_FPGA = 0xAA; + wait_ms(20); + + *data = 0x55; + //REG_FPGA = 0x55; + wait_ms(20); + */ + } + + + return 0; + } + + + \ No newline at end of file ------------------------------------------------------------- aversive_projects/eirbot2007/unioc_external_ram/uart_config.h (1.1) ------------------------------------------------------------- *************** *** 0 **** --- 1,72 ---- + /* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: uart_config.h,v 1.1 2007-01-25 19:18:49 enseirb Exp $ + * + */ + + /* Droids-corp 2004 - Zer0 + * config for uart module + */ + + #ifndef UART_CONFIG_H + #define UART_CONFIG_H + + /* + * UART0 definitions + */ + + /* compile uart0 fonctions, undefine it to pass compilation */ + #define UART0_COMPILE + + /* enable uart0 if == 1, disable if == 0 */ + #define UART0_ENABLED 1 + + /* enable uart0 interrupts if == 1, disable if == 0 */ + #define UART0_INTERRUPT_ENABLED 1 + + #define UART0_BAUDRATE 38400 + + /* + * if you enable this, the maximum baudrate you can reach is + * higher, but the precision is lower. + */ + #define UART0_USE_DOUBLE_SPEED 0 + //#define UART0_USE_DOUBLE_SPEED 1 + + #define UART0_RX_FIFO_SIZE 4 + #define UART0_TX_FIFO_SIZE 4 + //#define UART0_NBITS 5 + //#define UART0_NBITS 6 + //#define UART0_NBITS 7 + #define UART0_NBITS 8 + //#define UART0_NBITS 9 + + #define UART0_PARITY UART_PARTITY_NONE + //#define UART0_PARITY UART_PARTITY_ODD + //#define UART0_PARITY UART_PARTITY_EVEN + + #define UART0_STOP_BIT UART_STOP_BITS_1 + //#define UART0_STOP_BIT UART_STOP_BITS_2 + + + + + /* .... same for uart 1, 2, 3 ... */ + + #endif + ------------------------------------------------------- aversive_projects/eirbot2007/unioc_test_asserv/Makefile (1.1) ------------------------------------------------------- *************** *** 0 **** --- 1,21 ---- + TARGET = main + + # repertoire des modules + AVERSIVE_DIR = ../.. + + # List C source files here. (C dependencies are automatically generated.) + SRC = $(TARGET).c + + # List Assembler source files here. + # Make them always end in a capital .S. Files ending in a lowercase .s + # will not be considered source files but generated files (assembler + # output from the compiler), and will be deleted upon "make clean"! + # Even though the DOS/Win* filesystem matches both .s and .S the same, + # it will preserve the spelling of the filenames, and gcc itself does + # care about how the name is spelled on its command-line. + ASRC = + + ######################################## + + -include .aversive_conf + include $(AVERSIVE_DIR)/mk/aversive_project.mk --------------------------------------------------------------------------- aversive_projects/eirbot2007/unioc_test_asserv/encoders_eirbot_2k7_config.h (1.1) --------------------------------------------------------------------------- *************** *** 0 **** --- 1,40 ---- + // EIRBOT 2005 + // ToF + /** \file codeur_config.h + * \brief configuration du module codeur + * + * \todo il reste a implémanter la version sur irq + * + * \test a tester en version xil + * + * on peut configurer ici combien de codeurs seront utilisés + * et comment y accéder (interface bus xilinx ou ports en irq) + */ + + #ifndef _COUNTER_EIRBOT_2K7_CONFIG_ + #define _COUNTER_EIRBOT_2K7_CONFIG_ + + #include <avr/io.h> + + /** adresse la plus basse à partir de laquelle se trouvent toutes les autres données codeur. + * Ceci implique des adresses consécutives pour les modules codeurs + * #define BASE_CODEUR 0x1200 + */ + + #define BASE_ADRESS_ENCODERS 0x1300 + + /** nombre de codeurs implantés dans le FPGA et utilisés par le µc + */ + #define ENCODERS_NUMBER 4 + + /** Registre ENCODERS_CONFIG : + * correspondance numero de bit, codeur + */ + #define L_ENGINE_ENCODER 0 + #define R_ENGINE_ENCODER 1 + #define L_SEPARATED_ENCODER 2 + #define R_SEPARATED_ENCODER 3 + + #endif + + ----------------------------------------------------- aversive_projects/eirbot2007/unioc_test_asserv/main.c (1.1) ----------------------------------------------------- *************** *** 0 **** --- 1,76 ---- + /* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: main.c,v 1.1 2007-01-25 19:18:49 enseirb Exp $ + * + */ + + #include <stdlib.h> + #include <stdio.h> + #include <utils.h> + #include <wait.h> + #include <uart.h> + #include <pwm.h> + //#include <scheduler.h> + #include <encoders_eirbot_2k7.h> + + int main(void) + { + uint8_t i=0; + int32_t e0, e1, e2, e3; + + sbi(DDRB,7); + cbi(PORTB,7); + /* + uart_init(); + + fdevopen((int(*)(char))uart0_send, + (int(*)(char))uart0_recv, + 0); + */ + encoders_init((1<<L_ENGINE_ENCODER) | (1 <<R_ENGINE_ENCODER)); + + sei(); + + /* add microb encoders management */ + //scheduler_add_periodical_event(encoders_microb_manage, NULL, 1); + + pwm_set_3A(4095); + pwm_set_3C(-4095); + + wait_ms(1000); + + int32_t le0 = encoders_get_value(L_ENGINE_ENCODER); + int32_t le1 = encoders_get_value(R_ENGINE_ENCODER); + + while(1) + { + e0 = encoders_get_value(L_ENGINE_ENCODER); + e1 = encoders_get_value(R_ENGINE_ENCODER); + //e2 = encoders_get_value(L_SEPARATED_ENCODER); + //e3 = encoders_get_value(R_SEPARATED_ENCODER); + + pwm_set_3A( (e0 - le0)/1 ); + pwm_set_3C( (e1 - le1)/1 ); + + wait_ms(1); + //printf("%.8ld %.8ld %.8ld %.8ld\r\n", e0, e1, e2, e3); + } + + return 0; + + } ----------------------------------------------------------- aversive_projects/eirbot2007/unioc_test_asserv/pwm_config.h (1.1) ----------------------------------------------------------- *************** *** 0 **** --- 1,119 ---- + /* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: pwm_config.h,v 1.1 2007-01-25 19:18:49 enseirb Exp $ + * + */ + + /* Droids-corp, Eirbot, Microb Technology 2005 - Zer0 + * Config for PWM + */ + /** \file pwm_config.h + \brief Module to operate all PWM outputs + + \test not tested + + */ + + + #ifndef _PWM_CONFIG_ + #define _PWM_CONFIG_ + + /* Which PWM are enabled ? */ + //#define PWM0_ENABLED + //#define PWM1A_ENABLED + //#define PWM1B_ENABLED + //#define PWM1C_ENABLED + //#define PWM2_ENABLED + #define PWM3A_ENABLED + //#define PWM3B_ENABLED + #define PWM3C_ENABLED + + + /** max value for PWM entry, default 12 bits > 4095 */ + #define PWM_SIGNIFICANT_BITS 12 + + // timer configs (not all possibilities can be used at this time) + #define TIMER0_MODE TIMER_8_MODE_PWM + #define TIMER0_PRESCALE TIMER_8_PRESCALE_1 + + #define TIMER1_MODE TIMER_16_MODE_PWM_10 + #define TIMER1_PRESCALE TIMER_16_PRESCALE_1 + + #define TIMER2_MODE TIMER_8_MODE_PWM + #define TIMER2_PRESCALE TIMER_8_PRESCALE_1 + + #define TIMER3_MODE TIMER_16_MODE_PWM_10 + #define TIMER3_PRESCALE TIMER_16_PRESCALE_1 + + + + + /** config for pwm and signs + + The pwm mode is defined as follows : + you can add flags like the ones who follow : + + PWM_NORMAL : normal pwm, just to put a value if nothing else is needed + PWM_REVERSE : invert pwm output, not sign + + PWM_SIGNED : activate the sign output on a port (see config) + PWM_SIGN_INVERTED : invert sign output + PWM_SPECIAL_SIGN_MODE : if defined, the pwm is always near 0 for low values, + else negative low values are near 100% + + if you need for example a PWM1A with special sign mode you configure like this : + + #define PWM1A_MODE (PWM_SIGNED | PWM_SPECIAL_SIGN_MODE) + #define PWM1A_SIGN_PORT PORTB + #define PWM1A_SIGN_BIT 2 + + */ + + + + // example for signed pwm1A + #define PWM3A_MODE (PWM_SIGNED) + #define PWM3A_SIGN_PORT PORTE + #define PWM3A_SIGN_BIT 7 + + + #define PWM3C_MODE (PWM_SIGNED) + #define PWM3C_SIGN_PORT PORTE + #define PWM3C_SIGN_BIT 1 + + /** this tries to make the PWMs to synchronize. + experimental feature, could lead to problems. + to synch PWMs you need to enshure that the timers have same prescales, + and the same PWM mode */ + + //#define PWM_SYNCH + + /* choose one of these */ + //#define PWM_SYNCH_NO_PRESCALE + //#define PWM_SYNCH_PRESCALE_8 + #define PWM_SYNCH_PRESCALE_MORE + + #define TIMER_0_SYNCH + #define TIMER_1_SYNCH + #define TIMER_2_SYNCH + #define TIMER_3_SYNCH + + + + #endif + ----------------------------------------------------------------- aversive_projects/eirbot2007/unioc_test_asserv/scheduler_config.h (1.1) ----------------------------------------------------------------- *************** *** 0 **** --- 1,29 ---- + /* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: scheduler_config.h,v 1.1 2007-01-25 19:18:49 enseirb Exp $ + * + */ + + #ifndef _SCHEDULER_CONFIG_H_ + #define _SCHEDULER_CONFIG_H_ + + + #define SCHEDULER_NB_MAX_EVENT 5 + #define SCHEDULER_CLOCK_PRESCALER 8 + + #endif // _SCHEDULER_CONFIG_H_ ------------------------------------------------------------ aversive_projects/eirbot2007/unioc_test_asserv/uart_config.h (1.1) ------------------------------------------------------------ *************** *** 0 **** --- 1,72 ---- + /* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: uart_config.h,v 1.1 2007-01-25 19:18:49 enseirb Exp $ + * + */ + + /* Droids-corp 2004 - Zer0 + * config for uart module + */ + + #ifndef UART_CONFIG_H + #define UART_CONFIG_H + + /* + * UART0 definitions + */ + + /* compile uart0 fonctions, undefine it to pass compilation */ + #define UART0_COMPILE + + /* enable uart0 if == 1, disable if == 0 */ + #define UART0_ENABLED 1 + + /* enable uart0 interrupts if == 1, disable if == 0 */ + #define UART0_INTERRUPT_ENABLED 1 + + #define UART0_BAUDRATE 38400 + + /* + * if you enable this, the maximum baudrate you can reach is + * higher, but the precision is lower. + */ + #define UART0_USE_DOUBLE_SPEED 0 + //#define UART0_USE_DOUBLE_SPEED 1 + + #define UART0_RX_FIFO_SIZE 4 + #define UART0_TX_FIFO_SIZE 4 + //#define UART0_NBITS 5 + //#define UART0_NBITS 6 + //#define UART0_NBITS 7 + #define UART0_NBITS 8 + //#define UART0_NBITS 9 + + #define UART0_PARITY UART_PARTITY_NONE + //#define UART0_PARITY UART_PARTITY_ODD + //#define UART0_PARITY UART_PARTITY_EVEN + + #define UART0_STOP_BIT UART_STOP_BITS_1 + //#define UART0_STOP_BIT UART_STOP_BITS_2 + + + + + /* .... same for uart 1, 2, 3 ... */ + + #endif + ---------------------------------------------------- aversive_projects/eirbot2007/unioc_test_pwm/Makefile (1.1) ---------------------------------------------------- *************** *** 0 **** --- 1,22 ---- + TARGET = main + + # repertoire des modules + AVERSIVE_DIR = ../.. + # VALUE, absolute or relative path : example ../.. # + + # List C source files here. (C dependencies are automatically generated.) + SRC = $(TARGET).c + + # List Assembler source files here. + # Make them always end in a capital .S. Files ending in a lowercase .s + # will not be considered source files but generated files (assembler + # output from the compiler), and will be deleted upon "make clean"! + # Even though the DOS/Win* filesystem matches both .s and .S the same, + # it will preserve the spelling of the filenames, and gcc itself does + # care about how the name is spelled on its command-line. + ASRC = + + ######################################## + + -include .aversive_conf + include $(AVERSIVE_DIR)/mk/aversive_project.mk -------------------------------------------------- aversive_projects/eirbot2007/unioc_test_pwm/main.c (1.1) -------------------------------------------------- *************** *** 0 **** --- 1,62 ---- + /* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: main.c,v 1.1 2007-01-25 19:18:49 enseirb Exp $ + * + */ + + #include <utils.h> + #include <pwm.h> + + + #define PIN_BRAKE 7 + + + int main(void) + { + + + /*****************************************/ + pwm_init(); + + // Enleve le frein + sbi(DDRB,7); + DDRE = 0xff; + + // enleve le frein => brake à 0; + cbi(PORTB,7); + + + pwm_set_3A(2046); + pwm_set_3C(546); + + while(1) + { + pwm_set_3A(2000); + pwm_set_3C(3000); + + wait_ms(2000); + + pwm_set_3C(500); + pwm_set_3A(1000); + wait_ms(2000); + + nop(); + } + + return 0; + } -------------------------------------------------------- aversive_projects/eirbot2007/unioc_test_pwm/pwm_config.h (1.1) -------------------------------------------------------- *************** *** 0 **** --- 1,119 ---- + /* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: pwm_config.h,v 1.1 2007-01-25 19:18:49 enseirb Exp $ + * + */ + + /* Droids-corp, Eirbot, Microb Technology 2005 - Zer0 + * Config for PWM + */ + /** \file pwm_config.h + \brief Module to operate all PWM outputs + + \test not tested + + */ + + + #ifndef _PWM_CONFIG_ + #define _PWM_CONFIG_ + + /* Which PWM are enabled ? */ + //#define PWM0_ENABLED + //#define PWM1A_ENABLED + //#define PWM1B_ENABLED + //#define PWM1C_ENABLED + //#define PWM2_ENABLED + #define PWM3A_ENABLED + //#define PWM3B_ENABLED + #define PWM3C_ENABLED + + + /** max value for PWM entry, default 12 bits > 4095 */ + #define PWM_SIGNIFICANT_BITS 12 + + // timer configs (not all possibilities can be used at this time) + #define TIMER0_MODE TIMER_8_MODE_PWM + #define TIMER0_PRESCALE TIMER_8_PRESCALE_1 + + #define TIMER1_MODE TIMER_16_MODE_PWM_10 + #define TIMER1_PRESCALE TIMER_16_PRESCALE_1 + + #define TIMER2_MODE TIMER_8_MODE_PWM + #define TIMER2_PRESCALE TIMER_8_PRESCALE_1 + + #define TIMER3_MODE TIMER_16_MODE_PWM_10 + #define TIMER3_PRESCALE TIMER_16_PRESCALE_1 + + + + + /** config for pwm and signs + + The pwm mode is defined as follows : + you can add flags like the ones who follow : + + PWM_NORMAL : normal pwm, just to put a value if nothing else is needed + PWM_REVERSE : invert pwm output, not sign + + PWM_SIGNED : activate the sign output on a port (see config) + PWM_SIGN_INVERTED : invert sign output + PWM_SPECIAL_SIGN_MODE : if defined, the pwm is always near 0 for low values, + else negative low values are near 100% + + if you need for example a PWM1A with special sign mode you configure like this : + + #define PWM1A_MODE (PWM_SIGNED | PWM_SPECIAL_SIGN_MODE) + #define PWM1A_SIGN_PORT PORTB + #define PWM1A_SIGN_BIT 2 + + */ + + + + // example for signed pwm1A + #define PWM3A_MODE (PWM_SIGNED) + #define PWM3A_SIGN_PORT PORTE + #define PWM3A_SIGN_BIT 7 + + + #define PWM3C_MODE (PWM_SIGNED) + #define PWM3C_SIGN_PORT PORTE + #define PWM3C_SIGN_BIT 1 + + /** this tries to make the PWMs to synchronize. + experimental feature, could lead to problems. + to synch PWMs you need to enshure that the timers have same prescales, + and the same PWM mode */ + + //#define PWM_SYNCH + + /* choose one of these */ + //#define PWM_SYNCH_NO_PRESCALE + //#define PWM_SYNCH_PRESCALE_8 + #define PWM_SYNCH_PRESCALE_MORE + + #define TIMER_0_SYNCH + #define TIMER_1_SYNCH + #define TIMER_2_SYNCH + #define TIMER_3_SYNCH + + + + #endif + -------------------------------------------------------------- aversive_projects/eirbot2007/unioc_test_pwm/scheduler_config.h (1.1) -------------------------------------------------------------- *************** *** 0 **** --- 1,29 ---- + /* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: scheduler_config.h,v 1.1 2007-01-25 19:18:49 enseirb Exp $ + * + */ + + #ifndef _SCHEDULER_CONFIG_H_ + #define _SCHEDULER_CONFIG_H_ + + + #define SCHEDULER_NB_MAX_EVENT 5 + #define SCHEDULER_CLOCK_PRESCALER 8 + + #endif // _SCHEDULER_CONFIG_H_ --------------------------------------------------------- aversive_projects/eirbot2007/unioc_test_pwm/uart_config.h (1.1) --------------------------------------------------------- *************** *** 0 **** --- 1,72 ---- + /* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: uart_config.h,v 1.1 2007-01-25 19:18:49 enseirb Exp $ + * + */ + + /* Droids-corp 2004 - Zer0 + * config for uart module + */ + + #ifndef UART_CONFIG_H + #define UART_CONFIG_H + + /* + * UART0 definitions + */ + + /* compile uart0 fonctions, undefine it to pass compilation */ + #define UART0_COMPILE + + /* enable uart0 if == 1, disable if == 0 */ + #define UART0_ENABLED 1 + + /* enable uart0 interrupts if == 1, disable if == 0 */ + #define UART0_INTERRUPT_ENABLED 1 + + #define UART0_BAUDRATE 9600 + + /* + * if you enable this, the maximum baudrate you can reach is + * higher, but the precision is lower. + */ + #define UART0_USE_DOUBLE_SPEED 0 + //#define UART0_USE_DOUBLE_SPEED 1 + + #define UART0_RX_FIFO_SIZE 4 + #define UART0_TX_FIFO_SIZE 4 + //#define UART0_NBITS 5 + //#define UART0_NBITS 6 + //#define UART0_NBITS 7 + #define UART0_NBITS 8 + //#define UART0_NBITS 9 + + #define UART0_PARITY UART_PARTITY_NONE + //#define UART0_PARITY UART_PARTITY_ODD + //#define UART0_PARITY UART_PARTITY_EVEN + + #define UART0_STOP_BIT UART_STOP_BITS_1 + //#define UART0_STOP_BIT UART_STOP_BITS_2 + + + + + /* .... same for uart 1, 2, 3 ... */ + + #endif + ---------------------------------------------------------- aversive_projects/eirbot2007/unioc_test_pwm/utils_config.h (1.1) ---------------------------------------------------------- *************** *** 0 **** --- 1,32 ---- + /* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: utils_config.h,v 1.1 2007-01-25 19:18:49 enseirb Exp $ + * + */ + + #ifndef _UTILS_CONFIG_ + #define _UTILS_CONFIG_ 1.0 // version + + uint8_t irqlockflags; /** there are two variants of the IRQ_LOCK(irqlockflags) macros + the "microb" one is stack space optimized + the normal one is code space and speed optimized (and reliable ;) + this is not very important for most applications, so don't care */ + #define USE_MICROB_IRQ + + + #endif //_UTILS_CONFIG_
_______________________________________________ Avr-list mailing list Avr-list@droids-corp.org CVSWEB : http://cvsweb.droids-corp.org/cgi-bin/viewcvs.cgi/aversive WIKI : http://wiki.droids-corp.org/index.php/Aversive DOXYGEN : http://zer0.droids-corp.org/doxygen_aversive/html/ BUGZILLA : http://bugzilla.droids-corp.org COMMIT LOGS : http://zer0.droids-corp.org/aversive_commitlog