local time: :: ()
heure officielle (en France) : ::(TZ:)
Heure UTC client: :: Offset client: s - delai: ms - - timeZone: Heure UTC: ::This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
en:programs_to_communicate_with_the_dds [2016/03/14 14:25] fwiotte |
en:programs_to_communicate_with_the_dds [2016/03/14 14:29] (current) fwiotte |
||
---|---|---|---|
Line 115: | Line 115: | ||
The init routine (SPI) for the ARM TM4C123GH6PM: | The init routine (SPI) for the ARM TM4C123GH6PM: | ||
- | // Enable Peripheral SSI0 | + | // Enable Peripheral SSI0 |
- | SysCtlPeripheralEnable (SYSCTL_PERIPH_GPIOA); // Enable GPIO port A SSI0. | + | SysCtlPeripheralEnable (SYSCTL_PERIPH_GPIOA); // Enable GPIO port A SSI0. |
- | SysCtlPeripheralEnable (SYSCTL_PERIPH_SSI0); | + | SysCtlPeripheralEnable (SYSCTL_PERIPH_SSI0); |
- | GPIOPinConfigure (GPIO_PA2_SSI0CLK); | + | GPIOPinConfigure (GPIO_PA2_SSI0CLK); |
- | GPIOPinConfigure (GPIO_PA3_SSI0FSS); | + | GPIOPinConfigure (GPIO_PA3_SSI0FSS); |
- | GPIOPinConfigure (GPIO_PA5_SSI0TX); | + | GPIOPinConfigure (GPIO_PA5_SSI0TX); |
- | GPIOPinTypeSSI (GPIO_PORTA_BASE, GPIO_PIN_5 | GPIO_PIN_3 | GPIO_PIN_2); | + | GPIOPinTypeSSI (GPIO_PORTA_BASE, GPIO_PIN_5 | GPIO_PIN_3 | GPIO_PIN_2); |
- | // GPIOPinTypeSSI (GPIO_PORTA_BASE, GPIO_PIN_5 | GPIO_PIN_2); | + | // GPIOPinTypeSSI (GPIO_PORTA_BASE, GPIO_PIN_5 | GPIO_PIN_2); |
- | SSIConfigSetExpClk (SSI0_BASE, SysCtlClockGet () SSI_FRF_MOTO_MODE_0, | + | SSIConfigSetExpClk (SSI0_BASE, SysCtlClockGet () SSI_FRF_MOTO_MODE_0, |
- | SSI_MODE_MASTER, 10000000, 8); | + | SSI_MODE_MASTER, 10000000, 8); |
- | SSIEnable (SSI0_BASE); // Enable the SSI | + | SSIEnable (SSI0_BASE); // Enable the SSI |
- | Example of a boot on ARM PORT TM4C123GH6PM: | + | |
+ | Example of initializing Port B on ARM TM4C123GH6PM: | ||
- | // Void PortB_Init (void) | + | // Void PortB_Init (void) |
- | volatile unsigned long delay; | + | volatile unsigned long delay; |
- | SYSCTL_RCGC2_R | = 0x00000002; // 1) activate clock for Port B | + | SYSCTL_RCGC2_R | = 0x00000002; // 1) activate clock for Port B |
- | delay = SYSCTL_RCGC2_R; // Allow for time clock to start | + | delay = SYSCTL_RCGC2_R; // Allow for time clock to start |
- | GPIO_PORTB_AMSEL_R = 0x00; // 3) disable analog one PB | + | GPIO_PORTB_AMSEL_R = 0x00; // 3) disable analog one PB |
- | GPIO_PORTB_PCTL_R = 0x00000000; // 4) PCTL GPIO is PB0 | + | GPIO_PORTB_PCTL_R = 0x00000000; // 4) PCTL GPIO is PB0 |
- | GPIO_PORTB_DIR_R | = 0xFF; // 5) PB0-PB7 is out | + | GPIO_PORTB_DIR_R | = 0xFF; // 5) PB0-PB7 is out |
- | // GPIO_PORTB_AFSEL_R & = ~ 0x01; // 6) disable alt funct on PB0 | + | // GPIO_PORTB_AFSEL_R & = ~ 0x01; // 6) disable alt funct on PB0 |
- | GPIO_PORTB_AFSEL_R & = ~ 0xFF; // 6) disable alt funct on PB0-PB7 | + | GPIO_PORTB_AFSEL_R & = ~ 0xFF; // 6) disable alt funct on PB0-PB7 |
- | GPIO_PORTB_DEN_R | = 0xFF; // 7) enable digital I / O on PB0-PB7 | + | GPIO_PORTB_DEN_R | = 0xFF; // 7) enable digital I / O on PB0-PB7 |
Example of initializing a USB-PORT for UART0 serial communication on the ARM TM4C123GH6PM: | Example of initializing a USB-PORT for UART0 serial communication on the ARM TM4C123GH6PM: | ||
- | // Void init_UART0 (void) | + | // Void init_UART0 (void) |
- | SysCtlPeripheralEnable (SYSCTL_PERIPH_UART0); | + | SysCtlPeripheralEnable (SYSCTL_PERIPH_UART0); |
- | SysCtlPeripheralEnable (SYSCTL_PERIPH_GPIOA); | + | SysCtlPeripheralEnable (SYSCTL_PERIPH_GPIOA); |
- | GPIOPinConfigure (GPIO_PA0_U0RX); | + | GPIOPinConfigure (GPIO_PA0_U0RX); |
- | GPIOPinConfigure (GPIO_PA1_U0TX); | + | GPIOPinConfigure (GPIO_PA1_U0TX); |
- | GPIOPinTypeUART (GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); | + | GPIOPinTypeUART (GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); |
- | UARTConfigSetExpClk (UART0_BASE, SysCtlClockGet (), 9600, | + | UARTConfigSetExpClk (UART0_BASE, SysCtlClockGet (), 9600, |
- | (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE)); | + | (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE)); |
| | ||
Example of declaration and initialization of the frequency word registers: | Example of declaration and initialization of the frequency word registers: | ||
- | // // AD9852 | + | // // AD9852 |
- | FTW0_ADRESS int = 0x02; | + | FTW0_ADRESS int = 0x02; |
- | // Unsigned long long FTW0 = 0x17E4B17E4B1; //1.75MHz@300MHz clk | + | // Unsigned long long FTW0 = 0x17E4B17E4B1; //1.75MHz@300MHz clk |
- | unsigned long long FTW0; | + | unsigned long long FTW0; |
- | // Float FTW0 = 0x17E4B17E4B1; //1.75MHz@300MHz clk | + | // Float FTW0 = 0x17E4B17E4B1; //1.75MHz@300MHz clk |
- | FTW0_NUM_BYTE int = 0x06; | + | FTW0_NUM_BYTE int = 0x06; |
- | // // AD9858 | + | // // AD9858 |
- | FTW1_ADRESS int = 0x03; | + | FTW1_ADRESS int = 0x03; |
- | unsigned long FTW1 = 0x418937; // @ 1000MHz 1MHz clk | + | unsigned long FTW1 = 0x418937; // @ 1000MHz 1MHz clk |
- | FTW1_NUM_BYTE int = 0x04; | + | FTW1_NUM_BYTE int = 0x04; |
- | // // AD9858 | + | // // AD9858 |
- | CFR_ADRESS int = 0x00; | + | CFR_ADRESS int = 0x00; |
- | unsigned long CFR = 0x79; // MSB first | + | unsigned long CFR = 0x79; // MSB first |
- | CFR_NUM_BYTE int = 0x04; | + | CFR_NUM_BYTE int = 0x04; |