Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

XMC™ Forum Discussions

Not applicable
Hello,

I am starting to play with the ADC functionality of the XMC1100. I thought I'd start by doing something really simple and ensuring that I can read off the registers correctly.

I have the following code below:

#define VADC0 (0x48030000) //Base Register Address for VADC block
#define ADC_SHS0 0x48034000 //Base Register Address for SHS0 Block

#define ID (0x0008) //Module Identification Register

void ADC_getModId(uint32_t *regVal)
{
uint32_t *pReg;
pReg = (uint32_t *) (VADC0 + ID);
printf("ADC_getModID::*pReg = 0x%X\r\n", (unsigned int) *pReg);
printf("ADC_getModID::pReg = 0x%X\r\n", (unsigned int) pReg);
*regVal= *pReg;
//return returnVal;
}

The above code consistently prints out the following:
ADC_getModID::*pReg = 0xFFFFFFFF
ADC_getModID::pReg = 0x4803008

(M = 0 if 0 if VADC0 is used, M = 4 if ADC_SHS0 is used)


I get this output regardless of whether or not I use VADC0 or ADC_SHS0 as the base address.
From the user manual, I should be getting 0x00C5C0XX for the VADC0 base and 0X0099C0XX for the ADC_SHS0 base address. These are values that should be set upon reset.

What am I missing here?
0 Likes
9 Replies
Not applicable
Uh, apparently it put smiley faces in my post. Reposting putting a slight change in the output.

chrisn wrote:
Hello,

I am starting to play with the ADC functionality of the XMC1100. I thought I'd start by doing something really simple and ensuring that I can read off the registers correctly.

I have the following code below:

#define VADC0 (0x48030000) //Base Register Address for VADC block
#define ADC_SHS0 0x48034000 //Base Register Address for SHS0 Block

#define ID (0x0008) //Module Identification Register

void ADC_getModId(uint32_t *regVal)
{
uint32_t *pReg;
pReg = (uint32_t *) (VADC0 + ID);
printf("ADC_getModID::*pReg = 0x%X\r\n", (unsigned int) *pReg);
printf("ADC_getModID:: pReg = 0x%X\r\n", (unsigned int) pReg);
*regVal= *pReg;
//return returnVal;
}

The above code consistently prints out the following:
ADC_getModID::*pReg = 0xFFFFFFFF
ADC_getModID:: pReg = 0x4803008

(M = 0 if 0 if VADC0 is used, M = 4 if ADC_SHS0 is used)


I get this output regardless of whether or not I use VADC0 or ADC_SHS0 as the base address.
From the user manual, I should be getting 0x00C5C0XX for the VADC0 base and 0X0099C0XX for the ADC_SHS0 base address. These are values that should be set upon reset.

What am I missing here?
0 Likes
Not applicable
I still haven't gotten a solution or clue for this, so maybe I'll give some more details about what I'm trying to do.

I got the XMC1100 evaluation kit and installed DAVE v4.1.2. My goal is to evaluate the XMC1100 series chips to see if it is suitable for my company's purpose. For that, I need the ADC to function.

I was pleased to see that DAVE has CE APPs to make implementing peripheral easier (got my UART working with minimal effort), but the Analog_IO APP doesn't really do anything (I'm guessing it's not fully implemented).
In order to make any progress, I really need the ADC to work. So I found an example project for DAVE to set up the ADC on the XMC1100, but that can only be used with DAVE 4.0.0.
I thought I'd just look at the reference manual for the XMC1100. From the manual, it would seem that I should be able to use the ADC interface by reading/writing to the appropriate control registers directly. So I started my trying to read and print the Module ID register, but I don't believe that's being done correctly (hence my earlier post).
0 Likes
Not applicable
Did you try reading that Module Identification Register in debugging mode ?
0 Likes
Not applicable
I tried with DAVE in debugging mode too. It keeps telling me that the data at that location is '0xFFFFFFFF'.
0 Likes
User10215
Level 4
Level 4
First like received
Hi chrisn,

I'm talking from my experience of the XMC4500 here but I guess the behaviour in the XMC1100 is somehow similar. The XMC4500 has the so called System Control Unit (SCU). In there you can "switch on" or "switch off" peripherals.
Did you de-assert the reset of the VADC-Unit in the SCU before you checked the ID?

Best regards,
Niclas
0 Likes
Not applicable
Hey Niclas,

Thanks for the tip, but unfortunately it really wasn't that helpful. I found the registers for enabling/disabling gating for VADC. There is an 'Enable Gating' register and a 'Disable Gating' register.
I tried setting the appropriate bit, but that seemed to not have any effect on my ability to read the ADC registers. I even found the Peripheral Privilege Access Register. Reading that indicates that my VADC registers should be accessible.
Whatever I'm supposed to do to get the ADC to function using the registers, the reference manual really doesn't make clear.

I was able to find a mistake I made earlier with DAVE's CE projects. When adding a new DAVE APP, their tutorials have you add some from the 'System' folder. In that folder, there is an 'ANALOG_IO' APP. I naturally assumed that this was their APP for ADC control, but that is not the case.
Dave has the app for ADC under 'General Purpose->Analog to Digital Conversion->ADC_MEASUREMENT'. This seems to function well, as I'm getting expected results when using it.

Thanks again though,
chrisn
0 Likes
User10215
Level 4
Level 4
First like received
Hi chris,

so is your problem solved? Using Dave is always a good solution!
Well if you're still interested in getting to run the ADC without Dave-Code...I had a quick look at the reference manual of the XMC1100. I guess you found the correct register in the "CGATSET0"-register. This should switch on the ADC. You should see if the "switch on" was successfull by reading Bit 0 of the "CGATSTAT0"-register.
However there is a sentence in the description above the "CGATSET0"-register:
"Every bit in this register is protected by the bit protection scheme as described in Memory Organization chapter."
Through that I found the "SCU_PASSWD"-register. If you're still interested have a look at that register and the description above it (beginning from the "7.4.2.1 Bit Protection Scheme"-chapter). It basically tells you to put in a "password" into that register in order to be able to write to the "CGATSET0"-register. Good luck!

Regards,
Niclas
0 Likes
Travis
Employee
Employee
First like received
Hi Chrisn,

Attached is a VADC example for XMC1200 using queue source using the low level driver. Hope this can resolve your problem for VADC.


chrisn wrote:
I still haven't gotten a solution or clue for this, so maybe I'll give some more details about what I'm trying to do.

I got the XMC1100 evaluation kit and installed DAVE v4.1.2. My goal is to evaluate the XMC1100 series chips to see if it is suitable for my company's purpose. For that, I need the ADC to function.

I was pleased to see that DAVE has CE APPs to make implementing peripheral easier (got my UART working with minimal effort), but the Analog_IO APP doesn't really do anything (I'm guessing it's not fully implemented).
In order to make any progress, I really need the ADC to work. So I found an example project for DAVE to set up the ADC on the XMC1100, but that can only be used with DAVE 4.0.0.
I thought I'd just look at the reference manual for the XMC1100. From the manual, it would seem that I should be able to use the ADC interface by reading/writing to the appropriate control registers directly. So I started my trying to read and print the Module ID register, but I don't believe that's being done correctly (hence my earlier post).
0 Likes
Not applicable
Hey Niclas,

I'd say my problem is solved for now. I tried setting the appropriate password in the SCU_PASSWD register, but that didn't seem to have an effect anywhere.
The peripherals seem to be buried under more layers of abstraction than I care to get into currently, so I think I'll just stick with using the DAVE APPS.

Thanks again,
chrisn
0 Likes