SparkFun Forums 

Where electronics enthusiasts find answers.

Tips, tricks, & best best practices using Artemis with your board designs.
User avatar
By rowanham
#244571
I apologize in advance. I have been searching for an answer to my questions through the documentation and the various forums, and I'm still not finding it. The answer is probably under my nose, but I'm just not seeing it.

I have an Artemis Micro Mod installed in a Micro Mod ATP carrier board. I am using the Ambiq SDK, and I can build the code and flash the board and that stuff seems to work fine. When I have that tiny SWD header soldered in (I'm too old for that mostly) I can even use pyocd to launch gdbserver, and I can debug my code with gdb. It's very nice!

However, what I'd like to do is connect an external signal to a pin on the ATP and trigger on and digitize the signal - like an oscilloscope. So I need to figure out how to configure an ADC Slot to connect to a pad that is routed out to a pin on the ATP board, and how to trigger on that same signal.

I'll try to turn this rambling note into concrete questions:
1. I've been assuming that the posts on the ATP board that are labeled A0 and A1, are connected to pad 16 and pad 29 on the Apollo, so I should use the Ambiq HAL to configure these pads as ADCSE0 and ADCSE1 (in Ambiq talk) getting me two channels/slots to use. Is this correct? Not the "should I" part, just the connectivity.
2. The documentation seems to be contradictory on the G0-G7 pins. I'm probably misreading it, but it's not clear to me which of these, if any, can be configured as an ADC input. It's also not clear to me exactly which pins in the Apollo3 datasheet these Artemis pins connect to. Is there a document that translates the Artemis names to Apollo names? That would really help. And I can read a schematic if that's available.
3. And what about the trigger signals? The Apollo3 data sheet seems to say that one cannot configure one pad to be an ADC input and an ADC trigger at the same time. But I also don't see any ADC trigger listed in the Artemis pin out. How am I supposed to trigger the ADC on a Micro Mod ATP? Or is it just not supported?

Just a pointer to the correct documentation will make me happy. Anyway, thank you for your time.
#244572
Hi,

I haven't used ADC triggering before on the Artemis / Apollo3, but I can help with the pin numbering. I was looking at it just the other day. If you are using the Arduino IDE - I assume you are - the pin numbering is defined in "pins.cpp" for the SFE_ARTEMIS_MM_PB variant. On my Windows machine, it is:

C:\Users\YOUR_USER\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\2.2.1\variants\SFE_ARTEMIS_MM_PB\config\pins.cpp

From there, A0 is pin 32 and A1 is pin 35.

Schematic-wise, you need to cross-reference both the schematic for the MicroMod Processor Board and the schematic for the ATP:
https://cdn.sparkfun.com/assets/3/e/0/b ... ematic.pdf
https://cdn.sparkfun.com/assets/2/9/5/8 ... ematic.pdf

Those two pins are labelled SCALED_ADC0 and SCALED_ADC1 on the processor board. They include an active divider circuit to scale 3.3V to 2.0V. The circuit is not quite rail-to-rail. I'd recommend plotting voltages against ADC values manually, so you can calculate the true gain and any clipping at low (~0V) and high (~3.3V) voltages.

I hope this helps,
Paul
#244574
to add:
1. Following the schematics (ATP-MM and Artemis-MM) A0 is connected to 32 and A1 is connected to 35. BUT not directly, the Artemis ADC can only handle reference up to 2V, so on the Artemis-MM there is scaling logic in between to scale 3v3 input DOWN to max 2V.

2. Following the schematics (ATP-MM and Artemis-MM)
G0 is connected to AD16
G1 is connected to AD33
G2 is connected to AD34
G3 is connected to D27
G4 is connected to D28
G5 is connected to AD29
G6 is connected to D14
G7 is connected to D15

So G0, G1, G2 and G5 can be used for ADC. WARNING: THESE ARE NOT SCALED !

3. As for the trigger information, in the apollo3 datasheet on page 417 you will find more information (https://cdn.sparkfun.com/assets/c/8/3/d ... EuNjAuMC4w)
#244618
Thank you very much, I had some of these pieces, but putting them all together makes everything much more clear! I think I will even be able to get the ADC trigger on the external signal, but there is still one thing to resolve first...

So chasing through the schematics and the data sheet and the HAL and BSP code, I can follow the posts labeled A0 and A1 on the MicroMod ATP board through the MicroMod connector and the level shifting circuit on the Artemis MicroMod board to pads 32 and 35 on the Apollo3 SoC. So far so good. In the artemis_micromod BSP, in file am_bsp_pins.c, I find g_AM_BSP_GPIO_A0 is defined with .uFuncSel = AM_HAL_PIN_32_GPIO. Over in the HAL, in file am_hal_pin.h, I find AM_HAL_PIN_32_GPIO is defined to be 3.

My problem is that I can't for the life of me figure out how to configure an ADC slot to read from an analog GPIO input, which is what pad 32, funcsel 3, is. The same line of thought applies to A1/pad 35/funcsel 3, with the same conclusion.

Please tell me that I am an idiot and there is a table or paragraph somewhere that I overlooked...
#244622
It is done with a function like: am_hal_gpio_pinconfig(32, g_AM_BSP_GPIO_A0) or am_hal_gpio_pinconfig(35, g_AM_BSP_GPIO_A1)
Look at the example ......./ AmbiqSuiteSDK/boards/apollo3_evb/examples/adc_lpmode2/src/adc_lpmode2.c. In the same apollo3_evb folder are 2 other ADC examples that might be interesting.
#244653
OK, I think I understand.

When the BSP says A0 is GPIO 32, it means use this if you want to use the post marked A0 as an arbitrary input or output. For the ADC to be connected to A0, you need to use ADCSE4 , and Pin 32, FuncSel 0. Similarly, to use A1 you need to configure a slot for ADCSE7, and use Pin 35, FuncSel 0.

I'm going to try this tonight. If it works, and my reading of the schematics and BSP and HAL are correct, then I should be able to use TRIG0 to trigger the ADC, and run my trigger signal into the post labeled COPI1. Whew!
 Topic permissions

You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum