2014-06-04 02:50 PM
2014-06-04 03:30 PM
static const rank_channel_tuple_t rank_channel_table[] = { /* Channel assignment */
{ IVSENSE_CH_A, 0 }, PA0 123_0
{ IVSENSE_CH_B, 4 }, PA4 12_4
{ IVSENSE_CH_C, 14 }, PB0 12_8
{ IVSENSE_CH_D, 15 }, PB1 12_9
{ IVSENSE_CH_E, 8 }, PC0 123_10
{ IVSENSE_CH_F, 9 }, PC1 123_11
{ IVSENSE_CH_G, 10 }, PC2 123_12
{ IVSENSE_CH_H, 11 }, PC3 123_13
{ IVSENSE_CH_I, 12 }, PC4 12_14
{ IVSENSE_CH_J, 13 }, PC5 12_15
{ IVSENSE_CORETEMP, 16 },
{ IVSENSE_VREFINT, 17 },
{ IVSENSE_VBAT, 18 }
};
Yikes! Either that table is bad, or the comments related to the pin assignments are wrong
2014-06-04 06:09 PM
Or I wrote down the wrong part (I was working with an F407 earlier today as well). The mapping above is really on the F405RGT6, 64-pin.
2014-06-04 07:18 PM
I'm not sure the bond out of the pins from the die makes any difference, I think you need to double check the A-J designators and the associated pins on the device in the schematic.
My annotations to the table relate the the GPIO assignments described in the code.GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0; /* Configure GPIOA.0 as analog input (CH A) */
GPIO_Init(GPIOA, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4; /* Configure GPIOA.4 as analog input (CH B) */
GPIO_Init(GPIOA, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0; /* Configure GPIOB.0 as analog input (CH C) */
GPIO_Init(GPIOB, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1; /* Configure GPIOB.1 as analog input (CH D) */
GPIO_Init(GPIOB, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0; /* Configure GPIOC.0 as analog input (CH E) */
GPIO_Init(GPIOC, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1; /* Configure GPIOC.1 as analog input (CH F) */
GPIO_Init(GPIOC, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2; /* Configure GPIOC.2 as analog input (CH G) */
GPIO_Init(GPIOC, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3; /* Configure GPIOC.3 as analog input (CH H) */
GPIO_Init(GPIOC, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4; /* Configure GPIOC.4 as analog input (CH I) */
GPIO_Init(GPIOC, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5; /* Configure GPIOC.5 as analog input (CH J) */
GPIO_Init(GPIOC, &GPIO_InitStructure);
2014-06-04 08:19 PM
A copy/paste/remove-the-proprietary-names error. I've relabeled the GPIO comments to match the order that the code is really in.
When I apply voltages to each of my inputs, I'm getting the correct changes but the data in the output array is in the wrong spot when I have 13 inputs.Expected for 13 inputs and actual with 12 inputs based on ADC_RegularChannelConfig(): Ch_A, Ch_B, Ch_C...Actual with 13 inputs: Ch_J, CoreTemp, Vrefint, Vbat, Ch_A, Ch_B, ....2014-06-05 09:38 AM
Understood.
Not sure why it would foul the order up, I'd perhaps use half-words, but need to stand some code up to see if I can independently duplicate.2014-06-05 05:58 PM
I tried switching both the Memory and Peripheral DMA flags to to half-words and got the same results.
2014-07-24 01:46 PM
I didn't want to leave this thread hanging.: I finally got back to this with a newer build of code -- the ADC section had been turned off since it wasn't required for what we were using. Everything is working now. Interestingly, going back to the version that had the offsets in the output still shows the data incorrectly. Nothing stands out as being different.
This is concerning and I'll have to look further into it.