Перейти к содержанию
    

devfom

Участник
  • Постов

    8
  • Зарегистрирован

  • Посещение

Репутация

0 Обычный

Информация о devfom

  • День рождения 02.08.1990
  1. Много времени прошло, но: не могли бы поделиться наработками, или свежей информацией о том, как завести MSP430F5438+CS8900, и в идеале + FreeRTOS, но интересует код хотябы стека т.к. попытки завести старые порты не увенчались успехом.
  2. 4.0

    Upd: разобрался, не без помощи, скоро опубликую линк на пошаговое руководство.
  3. 4.0

    Добрый день. Не подскажите как начать работать с 4 версией для MSP430F5438. Среда IAR 4.2. Просто по пунктам какой бранч нужно checkout( т.к есть pre-V400 и TService, в которой вроде бы тоже исходники самой ОС) и что понадобится в проекте. И также как настроить работу самих тиков, если в исходниках этого нет. Спасибо.
  4. К сожалению уровни посмотреть не могу, пишут под собранную железку и никуда не добраться. Pull-up резисторы есть. Т.е выходит, что цикл инициализации USCI в режим I2C начинать с UCB1STAT & UCBBUSY, и если вернет истину, то делать сброс, а потом конфигурировать? Я заметил дебаггером, что флаг UCBBUSY устанавливается уже после инициализации, а не до того. В этом случае делаем Bus clear, и после него инициализировать все заново? Поправил Bus clear функцию: void vI2CBusClear() { char pulseCounter = 0; P5SEL &= ~BIT4; P5OUT &= ~BIT4; for( pulseCounter = 0; pulseCounter < 9; pulseCounter++ ) { P5DIR ^= BIT4; __delay_cycles( 100 ); } P5DIR &= ~BIT4; P5SEL |= BIT4; } Спасибо.
  5. MSP430 и I2C. Постоянно - UCBBUSY.

    Добрый день. Есть микроконтроллер MSP40F5438 и не могу побороть проблему замкнутого цикла while( UCB1STAT & UCBBUSY ); Поиск показал, что я не одинок, и нашел информацию о том, что необходимо реализовывать I2C Bus Clear, из спецификации. Для этого написал простой цикл( здесь, и далее я использую UCB1, у которого PORT5.4 - SCL, PORT3.7 - SDA): P5DIR |= BIT4; P5SEL &= ~BIT4; P5OUT &= ~BIT4; for( pulseCounter = 0; pulseCounter < 9; pulseCounter++ ) { P5OUT |= BIT4; __delay_cycles( 100 ); P5OUT &= ~BIT4; __delay_cycles( 100 ); } P5OUT |= BIT4; P5SEL |= BIT4; После его выполнения, шина по прежнему остается занятой. Микроконтроллер работает на частоте 25МГц поэтому __delay_cycles( 100 ); дает задержку в 5мкс. Как все таки правильно делать ресет шины? Единственное, что пока я нашел, что шина становится свободной, как только я переподключаю девайс с которым общаюсь. Протокол обмена с девайсом прост - изначально контроллер и девайс находятся в режиме в slave-receiver, а переключаются в master-transmitter только когда нужно что-то передать. После конфигурирования, мне необходимо инициализировать девайс, но это невозможно т.к шина занята. Спасибо за любые идеи.
  6. FreeRTOS 7.0.1 + MSP430F5438

    Добрый день. Помогите побороть FreeRTOS, на данный момент все собирается, запускаю в Debug и в Debug Log вижу: Порядок действий такой: 1. Скачал FreeRTOS 7.0.1 c www.freertos.org. 2. Создал в IAR Embedded Workbench for MSP430 4.20 пустой проект. 3. Добавил к проекту файлы из папки Source(tasks.c, list.c, queu.c), папку Include, все содержимое папки FreeRTOS\Source\portable\IAR\MSP430X. 4. Из папки FreeRTOS\Demo\MSP430X_MSP430F5438_IAR добавляю FreeRTOSConfig.h его немного правлю и в результате получаю: /* FreeRTOS V7.0.1 - Copyright (C) 2011 Real Time Engineers Ltd. *************************************************************************** * * * FreeRTOS tutorial books are available in pdf and paperback. * * Complete, revised, and edited pdf reference manuals are also * * available. * * * * Purchasing FreeRTOS documentation will not only help you, by * * ensuring you get running as quickly as possible and with an * * in-depth knowledge of how to use FreeRTOS, it will also help * * the FreeRTOS project to continue with its mission of providing * * professional grade, cross platform, de facto standard solutions * * for microcontrollers - completely free of charge! * * * * >>> See http://www.FreeRTOS.org/Documentation for details. <<< * * * * Thank you for using FreeRTOS, and thank you for your support! * * * *************************************************************************** This file is part of the FreeRTOS distribution. FreeRTOS is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License (version 2) as published by the Free Software Foundation AND MODIFIED BY the FreeRTOS exception. >>>NOTE<<< The modification to the GPL is included to allow you to distribute a combined work that includes FreeRTOS without being obliged to provide the source code for proprietary components outside of the FreeRTOS kernel. FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it can be viewed here: http://www.freertos.org/a00114.html and also obtained by writing to Richard Barry, contact details for whom are available on the FreeRTOS WEB site. 1 tab == 4 spaces! http://www.FreeRTOS.org - Documentation, latest information, license and contact details. http://www.SafeRTOS.com - A version that is certified for use in safety critical systems. http://www.OpenRTOS.com - Commercial support, development, porting, licensing and training services. */ #ifndef FREERTOS_CONFIG_H #define FREERTOS_CONFIG_H /*----------------------------------------------------------- * Application specific definitions. * * These definitions should be adjusted for your particular hardware and * application requirements. * * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE. * * See http://www.freertos.org/a00110.html. *----------------------------------------------------------*/ #define configUSE_PREEMPTION 1 #define configUSE_IDLE_HOOK 0 #define configUSE_TICK_HOOK 0 #define configCPU_CLOCK_HZ ( 18000000UL ) #define configTICK_RATE_HZ ( ( portTickType ) 1000 ) #define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 5 ) #define configTOTAL_HEAP_SIZE ( ( size_t ) ( 15 * 1024 ) ) #define configMAX_TASK_NAME_LEN ( 10 ) #define configUSE_TRACE_FACILITY 0 #define configUSE_16_BIT_TICKS 0 #define configIDLE_SHOULD_YIELD 1 #define configUSE_MUTEXES 1 #define configQUEUE_REGISTRY_SIZE 5 #define configGENERATE_RUN_TIME_STATS 0 #define configCHECK_FOR_STACK_OVERFLOW 0 #define configUSE_RECURSIVE_MUTEXES 0 #define configUSE_MALLOC_FAILED_HOOK 0 #define configUSE_APPLICATION_TASK_TAG 0 #if __DATA_MODEL__ == __DATA_MODEL_SMALL__ #define configMINIMAL_STACK_SIZE ( ( unsigned short ) 110 ) #else #define configMINIMAL_STACK_SIZE ( ( unsigned short ) 80 ) #endif /* Co-routine definitions. */ #define configUSE_CO_ROUTINES 0 #define configMAX_CO_ROUTINE_PRIORITIES ( 2 ) /* Set the following definitions to 1 to include the API function, or zero to exclude the API function. */ #define INCLUDE_vTaskPrioritySet 1 #define INCLUDE_uxTaskPriorityGet 1 #define INCLUDE_vTaskDelete 0 #define INCLUDE_vTaskCleanUpResources 0 #define INCLUDE_vTaskSuspend 1 #define INCLUDE_vTaskDelayUntil 1 #define INCLUDE_vTaskDelay 1 /* The MSP430X port uses a callback function to configure its tick interrupt. This allows the application to choose the tick interrupt source. configTICK_VECTOR must also be set in FreeRTOSConfig.h to the correct interrupt vector for the chosen tick interrupt source. This implementation of vApplicationSetupTimerInterrupt() generates the tick from timer A0, so in this case configTICK__VECTOR is set to TIMER0_A0_VECTOR. */ #define configTICK_VECTOR TIMER0_A0_VECTOR /* Prevent the following definitions being included when FreeRTOSConfig.h is included from an asm file. */ #ifdef __ICC430__ extern void vConfigureTimerForRunTimeStats( void ); extern volatile unsigned long ulStatsOverflowCount; #endif /* __ICCARM__ */ /* Configure a 16 bit timer to generate the time base for the run time stats. The timer is configured to interrupt each time it overflows so a count of overflows can be kept - that way a 32 bit time value can be constructed from the timers current count value and the number of overflows. */ #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() vConfigureTimerForRunTimeStats() /* Construct a 32 bit time value for use as the run time stats time base. This comes from the current value of a 16 bit timer combined with the number of times the timer has overflowed. */ #define portALT_GET_RUN_TIME_COUNTER_VALUE( ulCountValue ) \ { \ /* Stop the counter counting temporarily. */ \ TA1CTL &= ~MC__CONTINOUS; \ \ /* Check to see if any counter overflow interrupts are pending. */ \ if( ( TA1CTL & TAIFG ) != 0 ) \ { \ /* An overflow has occurred but not yet been processed. */ \ ulStatsOverflowCount++; \ \ /* Clear the interrupt. */ \ TA1CTL &= ~TAIFG; \ } \ \ /* Generate a 32 bit counter value by combinging the current peripheral \ counter value with the number of overflows. */ \ ulCountValue = ( ulStatsOverflowCount << 16UL ); \ ulCountValue |= ( unsigned long ) TA1R; \ TA1CTL |= MC__CONTINOUS; \ } #endif /* FREERTOS_CONFIG_H */ 5. Пробую собрать, получаю следующие ошибки: 6. Добавляю в port.c реализацию данных функций: /* The MSP430X port uses this callback function to configure its tick interrupt. This allows the application to choose the tick interrupt source. configTICK_VECTOR must also be set in FreeRTOSConfig.h to the correct interrupt vector for the chosen tick interrupt source. This implementation of vApplicationSetupTimerInterrupt() generates the tick from timer A0, so in this case configTICK_VECTOR is set to TIMER0_A0_VECTOR. */ void vApplicationSetupTimerInterrupt( void ) { const unsigned short usACLK_Frequency_Hz = 32768; /* Ensure the timer is stopped. */ TA0CTL = 0; /* Run the timer from the ACLK. */ TA0CTL = TASSEL_1; /* Clear everything to start with. */ TA0CTL |= TACLR; /* Set the compare match value according to the tick rate we want. */ TA0CCR0 = usACLK_Frequency_Hz / configTICK_RATE_HZ; /* Enable the interrupts. */ TA0CCTL0 = CCIE; /* Start up clean. */ TA0CTL |= TACLR; /* Up mode. */ TA0CTL |= MC_1; } /*-----------------------------------------------------------*/ void vConfigureTimerForRunTimeStats( void ) { /* Ensure the timer is stopped. */ TA1CTL = 0; /* Run the timer from the ACLK/2. */ TA1CTL = TASSEL_1 | ID__2; /* Clear everything to start with. */ TA1CTL |= TACLR; /* Enable the interrupts. */ TA1CCTL0 = CCIE; /* Start up clean. */ TA1CTL |= TACLR; /* Continuous mode. */ TA1CTL |= MC__CONTINOUS; } /*-----------------------------------------------------------*/ 7. Все собирается, делаю демо проект, следующего содержания: #include <stdio.h> #include <msp430x54x.h> #include "../include/FreeRTOS.h" #include "../include/task.h" #include "../include/queue.h" void vHelloWorldTask( void *pvParameters ) { for(;; ) { printf( "Hello, world\n" ); vTaskDelay( 100 ); } vTaskDelete( NULL ); } void main( void ) { //Stop watchdog timer to prevent time out reset WDTCTL = WDTPW + WDTHOLD; if( xTaskCreate( vHelloWorldTask, "HelloWorld", 100, NULL, 1, NULL) != pdTRUE ) { printf( "Can't create task."); } vTaskStartScheduler(); for(;; ) {} } 8. Получаю Target Reset и все. 8*. Полученная структура проекта: Что не так, или может я изначально не правильно подошел к процессу запуска системы?
  7. UART через DMA

    Спасибо, тогда действительно не стоит с ним забивать себе голову, так как пакеты не большие, их просто много. А как тогда реализовывать работу UART, видел что вроде делают через Circular Buffers? Или, может знакомы с FreeRTOS, как туда сразу приспособить для более удобной работы?
  8. UART через DMA

    Добрый день. Помогите разобраться с работой DMA, и настройкой работы UART через него в частности. Контроллер MSP430F5438, среда IAR. На данный момент, посмотрел работу проекта с сайта техаса, все работает, но как пытаюсь делать что-то свое, то не получается. В целом, не могу понять почему, если UART1 сгонфигурировать на работу с DMA0, то все отлично, если тоже самое проделать, но для работы с DMA1, то ничего не работает. Теперь немного выдержек из кода: Конфигурация USCI для работы в режиме UART: /* 1. Reset the USCI. */ UCA0CTL1 |= UCSWRST; /* 2. Initialize USCI registers. */ // No parity bit, one stop bit, 8-bit data, no echo, UART Mode, no multiprocessor mode UCA0CTL0 = 0x00; // Normal clocking scheme, SMCLK, start edge feature off, chars are data UCA0CTL1 |= UCSSEL1; /* Set the baudrate based on clock speed: ** 0x8A -> 57600Bd @ 8MHz CLK ** 0x9c -> 115200Bd @ 18MHz CLK ** 0x8B -> 115200Bd @ 16MHz CLK */ UCA0BR0 = 0x9c; UCA0BR1 = 0x00; // Set the modulation. UCA0MCTL = UCBRS_3 + UCBRF_0; /* 3. Configure ports. */ // Set the port pins P3.4, P3.5 for '1' as the peripherial function. P3SEL |= BIT5 + BIT4; // Configure P3.5 as ouptut and other pins as input. // In fact it's not nessary operation, because we have the default values. P3DIR |= BIT5; /* 4. Release the USCI for the operations. */ UCA0CTL1 &= ~UCSWRST; Сам код отправки: DMACTL0 = DMA0TSEL_17; __data16_write_addr( ( unsigned short )&DMA0SA, ( unsigned long )pSendingString ); __data16_write_addr((unsigned short) &DMA0DA,(unsigned long) &UCA0TXBUF); DMA0SZ = sizeof( pSendingString - 1 ); DMA0CTL = DMADT_0 + DMASRCINCR_3 + DMASBDB + DMAEN; UCA0IFG &= ~UCTXIFG; UCA0IFG |= UCTXIFG; С Texas работую впервые, в целом с контроллерами тоже недавно, потому хотелось узнать несколько моментов по-поводу кода, так как некоторые моменты взял из примеров и в принципе не особо понимаю, что они означают в частности: // Set the modulation. UCA0MCTL = UCBRS_3 + UCBRF_0; Прочитав документацию на контроллер, тоже не совсем ясно исходя из чего нужно выбирать полосу пропускания и как для выбранной частоты высчитывать множитель для регистра UCA0BR0. Так же было бы неплохо, если бы указали возможные недочеты в коде и пути исправления :) И напоследок, дабы не создавать нового топика вопрос архитектурного плана: работу UART через DMA я решил сделать, прочитав рекомeндации создателей FreeRTOS, так как именно для нее в дальнейшем это и понадобиться. В связи с этим вопрос: как лучше организовать в данном случае архитектуру, если предполагается около 4-5 UART устройств взаимодействующих с данным контроллером, и стоит ли городить весь UART через DMA, или же достаточно только RX части? Большое спасибо за любую оказанную помощь.
×
×
  • Создать...