LPC4370 ACDHS speed and DMA

LPC4370 ACDHS speed

AHB clock BASE_M4_CLK CLK_M4_ADCHS up to 204 MHz. For register interface.

ADCHS clock BASE_ADCHS_CLK CLK_ADCHS up to 80MHz For conversion rate.

How do I set up the BASE_M4_CLK or the AHB clocks for high speed ADC?

How do I verify the BASE_ADCHS_CLK is running (204Mhz ) fast enough for 80Msample?

But in reality, the HSADC clock structure is very simple and can be setup by directly setting the HSADC base clock with this one function:

Chip_Clock_SetBaseClock(CLK_BASE_ADCHS, BaseClock_XXXX, true, false);

You can attach the HSADC base clock to any of the following clock inputs:

/**
 * @brief CGU clock input list
 * These are possible input clocks for the CGU and can come
 * from both external (crystal) and internal (PLL) sources. These
 * clock inputs can be routed to the base clocks (@ref CHIP_CGU_BASE_CLK_T).
 */
typedef enum CHIP_CGU_CLKIN {
    CLKIN_32K,        /*!< External 32KHz input */
    CLKIN_IRC,        /*!< Internal IRC (12MHz) input */
    CLKIN_ENET_RX,    /*!< External ENET_RX pin input */
    CLKIN_ENET_TX,    /*!< External ENET_TX pin input */
    CLKIN_CLKIN,    /*!< External GPCLKIN pin input */
    CLKIN_RESERVED1,
    CLKIN_CRYSTAL,    /*!< External (main) crystal pin input */
    CLKIN_USBPLL,    /*!< Internal USB PLL input */
    CLKIN_AUDIOPLL,    /*!< Internal Audio PLL input */
    CLKIN_MAINPLL,    /*!< Internal Main PLL input */
    CLKIN_RESERVED2,
    CLKIN_RESERVED3,
    CLKIN_IDIVA,    /*!< Internal divider A input */
    CLKIN_IDIVB,    /*!< Internal divider B input */
    CLKIN_IDIVC,    /*!< Internal divider C input */
    CLKIN_IDIVD,    /*!< Internal divider D input */
    CLKIN_IDIVE,    /*!< Internal divider E input */
    CLKINPUT_PD        /*!< External 32KHz input */
} CHIP_CGU_CLKIN_T;

Connect the 204MHz main PLL to a divider input, set the divider to 3, and use the divider for the HSADC base clock.

Gives 204 / 3 = 68Mhz. Just make sure you aren‘t using those dividers for anything else!

Chip_Clock_SetDivider(CLK_IDIV_A, CLKIN_MAINPLL, 3); /* Setup divider A for main PLL rate divided by 3 */
Chip_Clock_SetBaseClock(CLK_BASE_ADCHS, CLKIN_IDIVA, true, false); /* HSADC base clock = divider A input */

Use the USB PLL rate (typically 480MHz) with a divide by 6 to get 80MHz. (Note different dividers have different maximum divider values)

Chip_USB0_Init(); /* Sets USB PLL to 480Mhz */
Chip_Clock_SetDivider(CLK_IDIV_D, CLKIN_USBPLL, 6); /* Setup divider D for USB PLL rate divided by 6 */
Chip_Clock_SetBaseClock(CLK_BASE_ADCHS, CLKIN_IDIVD, true, false); /* HSADC base clock = divider D input */

I think you might not be getting 20 MHz you will be getting 2MHz, as the only divider that can be sourced from USB0PLL is Divider A

(Max divider value supported by DIV_A is 4), if you attempt to source others [DIV_B to DIV_D] from USB0PLL it will default to IRC (12MHz).

Hence you will get "IRC CLK"/6 as the output. To get 80 MHz you can try the following

Chip_USB0_Init(); /* Initialize the USB0 PLL to 480 MHz */
Chip_Clock_SetDivider(CLK_IDIV_A, CLKIN_USBPLL, 2); /* Source DIV_A from USB0PLL, and set divider to 2 (Max div value supported is 4) [IN 480 MHz; OUT 240 MHz */
Chip_Clock_SetDivider(CLK_IDIV_B, CLKIN_IDIVA, 3); /* Source DIV_B from DIV_A, [IN 240 MHz; OUT 80 MHz */
Chip_Clock_SetBaseClock(CLK_BASE_ADCHS, CLKIN_IDIVB, true, false); /* Source ADHCS base clock from DIV_B */
Chip_Clock_EnableOpts(CLK_ADCHS, true, true, 1); /* Enable the clock */

480MHZ / 2 / 3 = 80 MHZ
Chip_Clock_GetRate(CLK_ADCHS); 

Finally I‘ve got some adequate results. ADCHS clock is 80MHz, but sample rate is only 40Msps, not 80Msps as I expected.

Chip_Clock_EnableOpts(CLK_ADCHS, true, true, 1); /* Enable the clock */

Every time I‘ve tried to set SAMPLERATE to values more than 4000000 - UART stopped working.

Is it real to get 80Msps?

The original hsadc.c file used TIMER1 to trigger a software event to trigger to start the ADC.

In my modification I tried to us the TIMMER1 to stop the ADC sampling but it did not work.

I found that there were too many IRQ events (with higher priority than the UART) causing the UART not to get service

and also the descriptor would not update.

I left the code in and set the SAMPLERATE to 100 which cause TIMER1 to file every 10ms.

I used this to toggle GPIO port 3 bit 7 for testing.

1111111111111

时间: 2024-12-15 01:38:59

LPC4370 ACDHS speed and DMA的相关文章

LabTool : LPC LINK2, LPC4370 cheap scope: 80Ms/s 12 bit

80MHz 12 bit ADC processor LPC4370.LPCxpresso do a LPC LINK2 and LABTOOLS open source oscilloscope demo set. (£84 from Mouser, seems quite well liked.) The LPC LINK2 is £14 + VAT from Mouser, it has the ADC on board. The Lab tools board has signal co

PatentTips - DMA address translation between peer-to-peer IO devices

BACKGROUND As processing resources have increased, demands to run multiple software programs and operating systems on a single microprocessor have also increased. To meet these demands virtual environments have been developed to allocate a single com

STM32CubeMX HAL库串口+DMA数据发送不定长度数据接收

参考资料:1.ST HAL库官网资料 2.https://blog.csdn.net/u014470361/article/details/79206352#comments 一.STM32CubeMX配置外部时钟 注意在进行外部时钟配置时,即"High Speed Clock"和"Low Speed Clock"需配置成"Crytal/Ceramic Resonator(低温/陶瓷谐振器)"不能配置为"BYASS Clock Sour

HAL UART DMA 数据收发

UART使用DMA进行数据收发,实现功能,串口2发送指令到上位机,上位机返回数据给串口2,串口2收到数据后由串口1进行转发,该功能为实验功能 1.UART与DMA通道进行绑定 1 void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle) 2 { 3 4 GPIO_InitTypeDef GPIO_InitStruct = {0}; 5 if(uartHandle->Instance==USART1) 6 { 7 /* USER CODE BEGI

kobox : dma_s3c.ko -v1 操作寄存器方式操作S3C2440的DMA

平台:TQ2440 linux版本:Linux EmbedSky 3.16.1-svn57 #56 Sat Oct 18 21:46:22 PDT 2014 armv4tl GNU/Linux 目标:v2中改成s3c2410_dma_xxx方式来操作DMA,看这里的寄存器映射是怎么使用系统接口来操作的! #include "dma.h" #define MEM_CPY_NO_DMA 0 #define MEM_CPY_DMA 1 //#define BUF_SIZE (512*1024

使用Page Speed Online改善网站速度

Google是一个伟大的企业,一直以来都非常重视网站的用户体验:对于用户体验,笔者认为,一个网站的用户体验好不好,一个很重要的因素就是网站的打开速度(加载速度):Google最近发布的在线网页加速工具--Page Speed Online,可分析任何网站的速度并且提供如何改进的建议. Page Speed对于一个网站来说,是一个很不错的工具,因为相当一部分的江西seo站长并不了解影响自己网站加载速度的因素有哪些,也就不知道如何去改进自己网站的加载速度.下面就以笔者的博客为例,来阐述一下Page

CYPE.V2015综合建筑设计和分析软件+CD-ADAPCO.SPEED.10.04.011.WIN32

CD-ADAPCO.SPEED.10.04.011.WIN32完整的电机解决方案   CD-adapco 是专注于计算流体动力学的全球最大非上市计算机辅助工程提供商.技术领先的模拟套装STAR-CCM+® 和 STAR-CD® 是该公司的主打产品.CD-adapco 的业务范围突破了计算流体动力学软件开发的范围,囊括了流体动力学.热传递和结构工程方面的各种计算机辅助工程设计服务.该公司一直秉承着"通过工程模拟软件和服务激发创新和降低成本"的使命. CD-ADAPCO.SPEED-为电机

Coding for Speed 技术分享

上周和公司技术同事们作了次<Coding for Speed>技术分享,本来这只是再普通不过的技术探讨和交流(虽然挂了个颇有噱头的名称),但分享的时候逻辑没理好,语速很快,时间也太紧,因此难言是合格的"分享"."探讨",所以我觉得有必要以简短的文章形式对原 PPT 作点补充,即便分享的内容很少也很简单. 本文将按原 PPT 的内容顺序分别作扩展说明或阐述,部分敏感信息将隐去,或只会简单提及. 作本技术分享的初衷,一是在工作中了解及接触了一些我个人认为可优

论文笔记之:Speed Up Tracking by Ignoring Features

Speed Up Tracking by Ignoring Features CVPR 2014 Abstract:本文提出一种特征选择的算法,来实现用最"精简"的特征以进行目标跟踪.重点是提出一种上界 (Upper Bound)来表示一块区域包含目标物体的概率,并且忽略掉这个 bound比较小的区域.我们的实验表明,忽略掉 90%的特征,仍然取得了不错的结果(未损失精度). Ignoring Features in Tracking .  基于滑动窗口的跟踪器,计算大量的 bound