STM32F3 ADC
Jaroslav Buchta
jaroslav.buchta na hascomp.cz
Úterý Prosinec 18 19:13:10 CET 2018
Tak super, uz to funguje jak vino.
Jen jedna divna vec, zpracovavam tam rychle ADC data a myslel jsem si,
ze kdyz vse, krome DMA bufferu presunu do CCM RAM, tak by se to mohlo
trosku zrychlit protoze se pristupy do RAM nebudou prat s DMA - opak je
pravdou, operace trva o chlup dele. Kod v disassembleru vypada tak nejak
stejne, nejake vysvetleni?
Testovaci program ISR je pro test zatim takto a ISR trva v prumeru 2.5us
pro RAM a 2.7us pro CCM. V RAM ma cas trosku vetsi rozptyl. Nejake
vysvetleni? Myslel jsem, ze CCM je pro procesor nejlepe pristupna, dela
to nejaka zapisova cache?
//static volatile uint16_t outputCurr[14]
__attribute__((section(".ccmram")));
//static uint16_t limitCurr[14] __attribute__((section(".ccmram")));
//static uint8_t overCurr[14] __attribute__((section(".ccmram")));
static volatile uint16_t outputCurr[14];
static uint16_t limitCurr[14];
static uint8_t overCurr[14];
...........
#define ADCPROCCURR(sofs, dofs, port, pin) v = pbuf[sofs]; \
if (v > limitCurr[dofs])
{LL_GPIO_ResetOutputPin(port, pin); overCurr[dofs] = 1; } \
outputCurr[dofs] = v
void adcsvc_IsrDma (int phase)
{
uint16_t *pbuf = phase ? (uint16_t *)
&adc1_dma_buffer[ADC_CHANNELS] : (uint16_t *) &adc1_dma_buffer[0];
register uint16_t v;
ADCPROCCURR(1, 0, DIAG2_GPIO_Port, DIAG2_Pin);
ADCPROCCURR(5, 1, DIAG2_GPIO_Port, DIAG2_Pin);
ADCPROCCURR(4, 2, DIAG2_GPIO_Port, DIAG2_Pin);
ADCPROCCURR(3, 3, DIAG2_GPIO_Port, DIAG2_Pin);
ADCPROCCURR(2, 4, DIAG2_GPIO_Port, DIAG2_Pin);
ADCPROCCURR(7, 5, DIAG2_GPIO_Port, DIAG2_Pin);
ADCPROCCURR(9, 6, DIAG2_GPIO_Port, DIAG2_Pin);
ADCPROCCURR(8, 7, DIAG2_GPIO_Port, DIAG2_Pin);
ADCPROCCURR(7, 8, DIAG2_GPIO_Port, DIAG2_Pin);
ADCPROCCURR(6, 9, DIAG2_GPIO_Port, DIAG2_Pin);
ADCPROCCURR(2, 10, DIAG2_GPIO_Port, DIAG2_Pin);
ADCPROCCURR(9, 11, DIAG2_GPIO_Port, DIAG2_Pin);
ADCPROCCURR(8, 12, DIAG2_GPIO_Port, DIAG2_Pin);
ADCPROCCURR(7, 13, DIAG2_GPIO_Port, DIAG2_Pin);
}
Další informace o konferenci Hw-list