Skip to content

lpc546xx: fix adc #5516

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 22, 2017
Merged

lpc546xx: fix adc #5516

merged 3 commits into from
Nov 22, 2017

Conversation

gorazdko
Copy link
Contributor

Fix #5304 according to UM10912.pdf (Chapter 44.3)

Status

Ready

@gorazdko
Copy link
Contributor Author

@mmahadevan108

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 17, 2017

/morph build

@mbed-ci
Copy link

mbed-ci commented Nov 17, 2017

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 17, 2017

Please look at failure [Error] analogin_api.c@47,0: #20: identifier "SYSCON_PDRUNCFGCLR_PDEN_ADC0_SHIFT" is undefined

@gorazdko
Copy link
Contributor Author

gorazdko commented Nov 17, 2017

Both targets, LPC546XX and LPC54144 compile now.

SYSCON_PDRUNCFG_PDEN_ADC0_SHIFT is seen by both.

Tested only LPC546XX which i have.

uint32_t pin_number = pin & 0x1F;
uint8_t port_number = pin / 32;

/* Clear the PDEN_ADC0 bit in the PDRUNCFG0 */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This bit is cleared inside ADC_ClockPower_Configuration() function. The below lines of code can be deleted.

Copy link
Contributor Author

@gorazdko gorazdko Nov 17, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My debugger is saying its not cleared and i get wrong measurements, always around 1700. Ill check again and let you know...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • If i delete lines:
    withoutlines

  • If i dont:
    withlines

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its called DIGIMODE bit. Ill correct

@@ -69,6 +77,7 @@ uint16_t analogin_read_u16(analogin_t *obj)
adcConvSeqConfigStruct.interruptMode = kADC_InterruptForEachSequence;

ADC_SetConvSeqAConfig(adc_addrs[instance], &adcConvSeqConfigStruct);
ADC_EnableConvSeqA(adc_addrs[instance], true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this, apologies for missing this line.

reg = IOCON->PIO[port_number][pin_number] & ~IOCON_PIO_DIGIMODE_MASK;
reg &= ~(1UL << SYSCON_PDRUNCFG_PDEN_ADC0_SHIFT);
reg &= ~(1UL << IOCON_PIO_DIGIMODE_SHIFT);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need this line as the previous line has already cleared the bit.

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 20, 2017

/morph build

@mbed-ci
Copy link

mbed-ci commented Nov 20, 2017

Build : SUCCESS

Build number : 553
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/5516/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build

@mbed-ci
Copy link

mbed-ci commented Nov 20, 2017

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 20, 2017

/morph export-build

@mbed-ci
Copy link

mbed-ci commented Nov 20, 2017

@mbed-ci
Copy link

mbed-ci commented Nov 21, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants