started on ads1299 port

This commit is contained in:
Nicolas Trimborn
2021-08-22 17:40:44 +02:00
parent 4dbced4c9d
commit 65e1957d2a
29 changed files with 458 additions and 1397 deletions

View File

@@ -597,8 +597,8 @@ drivers:
dmac_evosel_7: Event generation disabled
dmac_evosel_8: Event generation disabled
dmac_evosel_9: Event generation disabled
dmac_lvl_0: Channel priority 1
dmac_lvl_1: Channel priority 1
dmac_lvl_0: Channel priority 3
dmac_lvl_1: Channel priority 2
dmac_lvl_10: Channel priority 0
dmac_lvl_11: Channel priority 0
dmac_lvl_12: Channel priority 0
@@ -632,7 +632,7 @@ drivers:
dmac_lvlen0: true
dmac_lvlen1: true
dmac_lvlen2: true
dmac_lvlen3: false
dmac_lvlen3: true
dmac_lvlpri0: 0
dmac_lvlpri1: 0
dmac_lvlpri2: 0

View File

@@ -78,7 +78,7 @@
// <i> Indicates whether Priority Level 3 is enabled or not
// <id> dmac_lvlen3
#ifndef CONF_DMAC_LVLEN3
#define CONF_DMAC_LVLEN3 0
#define CONF_DMAC_LVLEN3 1
#endif
// <o> Level 3 Round-Robin Arbitration
@@ -225,7 +225,7 @@
// <i> Defines the arbitration level for this channel
// <id> dmac_lvl_0
#ifndef CONF_DMAC_LVL_0
#define CONF_DMAC_LVL_0 1
#define CONF_DMAC_LVL_0 3
#endif
// <q> Channel Event Output
@@ -449,7 +449,7 @@
// <i> Defines the arbitration level for this channel
// <id> dmac_lvl_1
#ifndef CONF_DMAC_LVL_1
#define CONF_DMAC_LVL_1 1
#define CONF_DMAC_LVL_1 2
#endif
// <q> Channel Event Output

View File

@@ -212,7 +212,7 @@
<AcmeProjectActionInfo Action="File" Source="config/hpl_adc_config.h" IsConfig="true" Hash="XAOTvk5xMalucgzL/ILTWw" />
<AcmeProjectActionInfo Action="File" Source="config/hpl_ccl_config.h" IsConfig="true" Hash="Q1yijLwNXjFOsGrwEEma+g" />
<AcmeProjectActionInfo Action="File" Source="config/hpl_cmcc_config.h" IsConfig="true" Hash="bmtxQ8rLloaRtAo2HeXZRQ" />
<AcmeProjectActionInfo Action="File" Source="config/hpl_dmac_config.h" IsConfig="true" Hash="G918OUWkTWu+b35DeetjBg" />
<AcmeProjectActionInfo Action="File" Source="config/hpl_dmac_config.h" IsConfig="true" Hash="KrByLQAm3PkkyOF4POgwZg" />
<AcmeProjectActionInfo Action="File" Source="config/hpl_eic_config.h" IsConfig="true" Hash="xKw8xm4k4XPALg++/jSPcw" />
<AcmeProjectActionInfo Action="File" Source="config/hpl_evsys_config.h" IsConfig="true" Hash="/3bNiu/UgpvPbmvfRA+w3g" />
<AcmeProjectActionInfo Action="File" Source="config/hpl_gclk_config.h" IsConfig="true" Hash="fvc5nhPTGTNHCTNlzs6nhA" />
@@ -419,7 +419,7 @@
<armgcc.compiler.optimization.PrepareFunctionsForGarbageCollection>True</armgcc.compiler.optimization.PrepareFunctionsForGarbageCollection>
<armgcc.compiler.optimization.DebugLevel>Maximum (-g3)</armgcc.compiler.optimization.DebugLevel>
<armgcc.compiler.warnings.AllWarnings>True</armgcc.compiler.warnings.AllWarnings>
<armgcc.compiler.miscellaneous.OtherFlags>-std=gnu11 -mfloat-abi=hard -mfpu=fpv4-sp-d16</armgcc.compiler.miscellaneous.OtherFlags>
<armgcc.compiler.miscellaneous.OtherFlags>-std=gnu99 -mfloat-abi=hard -mfpu=fpv4-sp-d16</armgcc.compiler.miscellaneous.OtherFlags>
<armgcc.linker.general.UseNewlibNano>True</armgcc.linker.general.UseNewlibNano>
<armgcc.linker.libraries.Libraries>
<ListValues>

View File

@@ -87,11 +87,11 @@ void SERCOM1_1_Handler()
//SPI_tx_buffer[0] += 1;
//tx_buffer[31] += 1;
//DMAC->Channel[0].CHCTRLA.reg |= DMAC_CHCTRLA_ENABLE;
//DMAC->Channel[1].CHCTRLA.reg |= DMAC_CHCTRLA_ENABLE;
DMAC->Channel[0].CHCTRLA.reg |= DMAC_CHCTRLA_ENABLE;
DMAC->Channel[1].CHCTRLA.reg |= DMAC_CHCTRLA_ENABLE;
_dma_enable_transaction(CONF_SERCOM_1_RECEIVE_DMA_CHANNEL, false);
_dma_enable_transaction(CONF_SERCOM_1_TRANSMIT_DMA_CHANNEL, false);
//_dma_enable_transaction(CONF_SERCOM_1_RECEIVE_DMA_CHANNEL, false);
//_dma_enable_transaction(CONF_SERCOM_1_TRANSMIT_DMA_CHANNEL, false);
//slave_select_high();
//_dma_enable_transaction(CONF_SERCOM_5_RECEIVE_DMA_CHANNEL, false);
@@ -108,6 +108,9 @@ void SERCOM1_3_Handler()
//tx_buffer[0] += 1;
//tx_buffer[31] += 1;
DMAC->Channel[0].CHCTRLA.reg |= DMAC_CHCTRLA_ENABLE;
DMAC->Channel[1].CHCTRLA.reg |= DMAC_CHCTRLA_ENABLE;
//_dma_enable_transaction(CONF_SERCOM_1_RECEIVE_DMA_CHANNEL, false);
//_dma_enable_transaction(CONF_SERCOM_1_TRANSMIT_DMA_CHANNEL, false);
@@ -134,15 +137,9 @@ void enable_NVIC_IRQ(void)
NVIC_SetPriority(DMAC_0_IRQn, 2);
NVIC_SetPriority(ADC1_0_IRQn, 3);
NVIC_EnableIRQ(TCC0_0_IRQn);
NVIC_SetPriority(TCC0_0_IRQn, 1);
NVIC_EnableIRQ(TCC1_0_IRQn);
NVIC_SetPriority(TCC1_0_IRQn, 1);
//NVIC_EnableIRQ(SERCOM5_0_IRQn);
NVIC_EnableIRQ(SERCOM1_1_IRQn);
NVIC_SetPriority(SERCOM1_1_IRQn, 0);
NVIC_EnableIRQ(SERCOM1_3_IRQn);
NVIC_SetPriority(SERCOM1_3_IRQn, 0);
//NVIC_EnableIRQ(SERCOM1_3_IRQn);
//NVIC_SetPriority(SERCOM1_3_IRQn, 0);
//NVIC_EnableIRQ(SERCOM1_3_IRQn);
//NVIC_EnableIRQ(EIC_5_IRQn);
}
@@ -234,6 +231,9 @@ int main(void)
One_ms_timer_init();
custom_logic_enable();
enable_NVIC_IRQ();
//DMAC->Channel[0].CHCTRLA.reg |= DMAC_CHCTRLA_ENABLE;
//DMAC->Channel[1].CHCTRLA.reg |= DMAC_CHCTRLA_ENABLE;
_dma_enable_transaction(CONF_SERCOM_1_RECEIVE_DMA_CHANNEL, false);
_dma_enable_transaction(CONF_SERCOM_1_TRANSMIT_DMA_CHANNEL, false);
@@ -246,12 +246,12 @@ int main(void)
/* Replace with your application code */
while (1) {
if (Motor1.timerflags.adc_readings_ready_tic) {process_currents();}
if (Motor1.timerflags.current_loop_tic) {
APPLICATION_StateMachine();
exec_commutation(&Motor1);
//exec_commutation(&Motor2);
}
//if (Motor1.timerflags.adc_readings_ready_tic) {process_currents();}
//if (Motor1.timerflags.current_loop_tic) {
//APPLICATION_StateMachine();
//exec_commutation(&Motor1);
////exec_commutation(&Motor2);
//}
if (Motor1.timerflags.motor_telemetry_flag) {
Motor1.timerflags.motor_telemetry_flag = false;
@@ -259,7 +259,7 @@ int main(void)
update_setpoints();
APPLICATION_StateMachine();
exec_commutation(&Motor1);
exec_commutation(&Motor2);
//exec_commutation(&Motor2);
//*M3_Joint_abs_position = as5048a_getRawRotation(&AS_1);
//*M3_Joint_abs_position = as5048a_getRotationDecInt(&AS_1);