Skip to content
Snippets Groups Projects
Commit d11b014f authored by Michael DM Dryden's avatar Michael DM Dryden
Browse files

Removed DAC DMA--causes artifacts in output.

parent 3dbb76df
Branches
Tags
No related merge requests found
......@@ -425,36 +425,36 @@ uint8_t lsv_experiment(int16_t start, int16_t stop, uint16_t slope, int8_t first
tc_write_period(&TCC1, 0xffff);
tc_write_period(&TCC0, (uint16_t)timer_period);
//DMA
struct dma_channel_config dmach_conf;
memset(&dmach_conf, 0, sizeof(dmach_conf));
dma_channel_set_burst_length(&dmach_conf, DMA_CH_BURSTLEN_1BYTE_gc);
dma_channel_set_transfer_count(&dmach_conf, 1);
dma_channel_set_src_reload_mode(&dmach_conf, DMA_CH_SRCRELOAD_TRANSACTION_gc);
dma_channel_set_dest_reload_mode(&dmach_conf, DMA_CH_DESTRELOAD_NONE_gc);
dma_channel_set_src_dir_mode(&dmach_conf, DMA_CH_SRCDIR_FIXED_gc);
dma_channel_set_source_address(&dmach_conf, (uint16_t)(uintptr_t)&TCC1.CNTH);
dma_channel_set_dest_dir_mode(&dmach_conf, DMA_CH_DESTDIR_FIXED_gc);
dma_channel_set_destination_address(&dmach_conf, (uint16_t)(uintptr_t)&USARTC1.DATA);
dma_channel_set_trigger_source(&dmach_conf, DMA_CH_TRIGSRC_OFF_gc);
dma_channel_set_single_shot(&dmach_conf);
dma_set_callback(0, (dma_callback_t)lsv_dma_callback);
dma_channel_set_interrupt_level(&dmach_conf, DMA_INT_LVL_HI);
dma_channel_write_config(0, &dmach_conf);
dma_set_callback(1, (dma_callback_t)lsv_dma_callback1);
dma_channel_set_source_address(&dmach_conf, (uint16_t)(uintptr_t)&TCC1.CNTL);
dma_channel_write_config(1, &dmach_conf);
}
dma_channel_enable(0);
// //DMA
// struct dma_channel_config dmach_conf;
// memset(&dmach_conf, 0, sizeof(dmach_conf));
//
// dma_channel_set_burst_length(&dmach_conf, DMA_CH_BURSTLEN_1BYTE_gc);
// dma_channel_set_transfer_count(&dmach_conf, 1);
//
// dma_channel_set_src_reload_mode(&dmach_conf, DMA_CH_SRCRELOAD_TRANSACTION_gc);
// dma_channel_set_dest_reload_mode(&dmach_conf, DMA_CH_DESTRELOAD_NONE_gc);
//
// dma_channel_set_src_dir_mode(&dmach_conf, DMA_CH_SRCDIR_FIXED_gc);
// dma_channel_set_source_address(&dmach_conf, (uint16_t)(uintptr_t)&TCC1.CNTH);
//
// dma_channel_set_dest_dir_mode(&dmach_conf, DMA_CH_DESTDIR_FIXED_gc);
// dma_channel_set_destination_address(&dmach_conf, (uint16_t)(uintptr_t)&USARTC1.DATA);
//
// dma_channel_set_trigger_source(&dmach_conf, DMA_CH_TRIGSRC_OFF_gc);
// dma_channel_set_single_shot(&dmach_conf);
//
// dma_set_callback(0, (dma_callback_t)lsv_dma_callback);
// dma_channel_set_interrupt_level(&dmach_conf, DMA_INT_LVL_HI);
//
// dma_channel_write_config(0, &dmach_conf);
//
// dma_set_callback(1, (dma_callback_t)lsv_dma_callback1);
// dma_channel_set_source_address(&dmach_conf, (uint16_t)(uintptr_t)&TCC1.CNTL);
// dma_channel_write_config(1, &dmach_conf);
}
//
// dma_channel_enable(0);
TCC1.CNT = dacindex_start;
......@@ -486,9 +486,9 @@ uint8_t lsv_experiment(int16_t start, int16_t stop, uint16_t slope, int8_t first
tce1_ovf_callback_lsv();
ret = 1;
goto aborting;
}
}
delay_cycles(300);
}
if (first_run == -1 || first_run == 2)
......@@ -524,21 +524,7 @@ static void porte_int0_lsv(void){
}
static void tcf0_ovf_callback(void){
/* max5443_set_voltage1(TCC1.CNT);*/
arch_ioport_set_pin_level(IOPORT_CREATE_PIN(PORTC, 4), false);
dma_channel_enable(0);
dma_channel_trigger_block_transfer(0);
}
static void lsv_dma_callback(void){
// while (!((&USARTC1)->STATUS & USART_DREIF_bm));
dma_channel_enable(1);
dma_channel_trigger_block_transfer(1);
}
static void lsv_dma_callback1(void){
while (!((&USARTC1)->STATUS & USART_DREIF_bm));
arch_ioport_set_pin_level(IOPORT_CREATE_PIN(PORTC, 4), true);
max5443_set_voltage1(TCC1.CNT);
}
static void tce1_ovf_callback_lsv(void){
......@@ -553,7 +539,6 @@ static void lsv_cca_callback(void){
PORTD.INTCTRL = PORT_INT0LVL_OFF_gc;
tc_set_overflow_interrupt_level(&TCC0, TC_OVFINTLVL_OFF_gc);
tc_set_cca_interrupt_level(&TCC1, TC_INT_LVL_OFF);
dma_channel_disable(0);
up = 0;
return;
}
......
......@@ -2,9 +2,6 @@
Microsoft Visual Studio Solution File, Format Version 11.00
# Atmel Studio Solution File, Format Version 11.00
Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "DSTAT-temp", "DSTAT-temp\DSTAT-temp.cproj", "{511F3FE1-F6B0-4E6D-877C-322C1167607E}"
ProjectSection(ProjectDependencies) = postProject
{F03C750F-9F8B-4E91-9B72-83F6D7CE27F4} = {F03C750F-9F8B-4E91-9B72-83F6D7CE27F4}
EndProjectSection
EndProject
Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "EEPROM init", "EEPROM init\EEPROM init.cproj", "{F03C750F-9F8B-4E91-9B72-83F6D7CE27F4}"
EndProject
......
No preview for this file type
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment