This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Some basics first:
IDE: CCS 7.3
OS: Windows 10
Data Sheet: Tiva™ TM4C123GH6PGE Microcontroller -15033.2672
Board: TM4C123GH6PGE
Code base: TivaWare_C_Series-2.1.4.178
Problem: I am trying something really simple but its not working (yet).
Here is my diagram:
Here is code I am using. It is taken from :
C:\ti\TivaWare_C_Series-2.1.4.178\examples\peripherals\adc\single_ended.c
The only changes I made were to set GPIO_PIN_6 (originally GPIO_PIN_3).
At lines 252 the peripheral is enabled using ip arg “SYSCTL_PERIPH_ADC0”.
It is defined in C:\ti\TivaWare_C_Series-2.1.4.178\driverlib\sysctl.h as
#define SYSCTL_PERIPH_ADC0 0xf0003800 // ADC 0
Question1: But there is no mention , no 0xf0003800 (or even 3800) that I can find in the datasheet. I verified the ADC0 base address but not this “peripheral” address. Where is it?
Question2: At line #75 SYSCTL_PERIPH_GPIOE is defined at address 0xf0000804.
Where is it’s corresponding value in the datasheet?
One last thing:
On Page 699, is Register 18 “GPIO Digital Enable (GPIODEN), offset 0x51C”.
It states “By default, all GPIO signals except those listed
below are configured out of reset to be undriven (tristate). Their digital function is disabled…”
Please confirm whether or not I need to set this register
Question1: But there is no mention , no 0xf0003800 (or even 3800) that I can find in the datasheet. I verified the ADC0 base address but not this “peripheral” address. Where is it?
The value 0xf0003800 is not an address. It is a value used in the function SysCtlPeripheralEnable(). In this case that function writes a "1" to address 0x400FE638 bit 0 to enable ADC0.
void SysCtlPeripheralEnable(uint32_t ui32Peripheral) { // // Check the arguments. // ASSERT(_SysCtlPeripheralValid(ui32Peripheral)); // // Enable this peripheral. // HWREGBITW(SYSCTL_RCGCBASE + ((ui32Peripheral & 0xff00) >> 8), ui32Peripheral & 0xff) = 1; }
Question2: At line #75 SYSCTL_PERIPH_GPIOE is defined at address 0xf0000804. Where is it’s corresponding value in the datasheet?
Again, that is not an address.
On Page 699, is Register 18 “GPIO Digital Enable (GPIODEN), offset 0x51C”. It states “By default, all GPIO signals except those listed below are configured out of reset to be undriven (tristate). Their digital function is disabled…” Please confirm whether or not I need to set this register
To use a pin as an analog input it is not necessary to set the GPIODEN bit for that pin.
Bob Crosby said:The value 0xf0003800 is not an address.
Bob Crosby said:Again, that is not an address.
uint32_t for everything strikes again.
Seriously, this passes up an easy safety check with no gain for not implementing it.
Robert
Well, my reply was simply to remark that I think the API could use some work with regards to the types used and the effect that has on the ability to detect errors. However you might want to look at your sequence configuration step and check what channel(s) you are configuring.
Robert