3533 views|0 replies

1662

Posts

0

Resources
The OP
 

NuMaker-IIoT-NUC980 Review EBI [Copy link]

Author: Ah Huatian

Introduction

NUC980 is equipped with an external bus interface (EBI) for external devices. EBI supports independent mode and multiplexed mode for address bus and data bus. The address bus supports a maximum address space of 1MB and the data bus supports a maximum width of 16 bits. EBI supports 3 chip select signals, which can directly connect to three external devices, and the 3 chip select signals can set the read and write timing separately.

Hardware introduction of functional modules

Official manual introduction

From the schematic diagram of the NuMaker-IIoT-NUC980 development board, we can see that some signals of the EBI bus are brought out to CON11, including the address bus ADDR[8~10], data bus DATA[0~15], chip select nCS0, read enable nRE, and write enable nWE.

Instructions for use of functional modules

Hardware Environment

NuMaker-IIoT-NUC980 development board (for testing, you need to solder 2.54mm double-row pins to CON11)
Two USB data cables (one to VCOM, the other to USB0)
Saleae logic logic analyzer (several test lines), CH0~7 connect to EBI_DATA0~7, CH8 connect to EBI_nWE, CH15 connect to EBI_nRE, CH10 connect to EBI_nCS0, CH11~13 connect to EBI_ADDR8~10

Software Environment

RT-Thread Studio
NuWriter
SecureCRT

Test demonstration of module functions

In the RT-Thread Studio environment, create a project based on the NK-980IOT development board. After the project is created, add the relevant initialization code of the ebi bus to the file. The initialization content includes the HCLK clock, ebi module clock enable, and ebi bus IO multiplexing function configuration, as follows:

Then add the nu_pin_ebi_init() function to the nu_pin_init() function.
Create a file, implement the read and write functions of the ebi bus test, and add it to the msh command. The code is as follows:

/****************************************************** *************************//**

*

* @copyright (C) 2019 Nuvoton Technology Corp. All rights reserved.

*

* SPDX-License-Identifier: Apache-2.0

*

* Change Logs:

* Date Author Notes

* 2022-03-26 yzh First version

*

*************************************************** ****************************/

#include

#include

#include

#include

static void ebi_open(void)

{

EBI_Open(EBI_BANK0,EBI_BUSWIDTH_8BIT,EBI_TIMING_NORMAL,EBI_OPMODE_NORMAL,EBI_CS_ACTIVE_LOW);/*Initialize ebi bus cs0*/

EBI_SetBusTiming(EBI_BANK0,0x03003318U,EBI_MCLKDIV_128);/*TAHD=3,TACC=3*/

}

static void ebi_close(void)

{

EBI_Close(EBI_BANK0);/*Close ebi bus cs0*/

}

static void ebi_read(int argc, char**argv)

{

uint32_t addr;

uint8_t bus_val;

sscanf(argv[1],"0x%x",&addr);

if(addr < 0x60000000 || addr > 0x600fffff)

{

rt_kprintf("%s@nk980iot: illegal address.\n",argv[0],addr);

return;

}

ebi_open();

bus_val = *((volatile uint8_t *)addr);

ebi_close();

rt_kprintf("%s@nk980iot: addr - 0x%x, data - 0x%x\n",argv[0],addr,bus_val);

}

MSH_CMD_EXPORT(ebi_read, ebi_read sample: ebi_read);

static void ebi_write(int argc, char**argv)

{

uint32_t addr;

uint32_t bus_val;

/*

for(int i; i

{

rt_kprintf("argc:%d, argv:%s\n",i,argv);

}

*/

sscanf(argv[1],"0x%x",&addr);

if(addr < 0x60000000 || addr > 0x600fffff)

{

rt_kprintf("%s@nk980iot: illegal address.\n",argv[0],addr);

return;

}

sscanf(argv[2],"0x%x",&bus_val);

ebi_open();

*((volatile uint8_t *)addr) = (uint8_t)bus_val;

ebi_close();

rt_kprintf("%s@nk980iot: addr - 0x%x, data - 0x%x\n",argv[0],addr,bus_val);

}

MSH_CMD_EXPORT(ebi_write, ebi_write sample: ebi_write);

After successfully building in the RT-Thread Studio environment, use NuWriter to download the program file "rtthread.bin" to the development board.

The program files and development board connections are ready. Open SecureCRT and execute the download program steps. The system starts successfully. You can see that the ebi read and write commands have been added to the Finsh console.

Read function test

First, connect the EBI_DATA1 signal to the VDD33 signal (other signals are connected to the logic analyzer at the default low level), so that the data on the 8-bit data bus is 0x02;

According to the chip manual, the CS0 address space is defined as 0x60000000~0x600FFFFF, and the address bus uses EBI_ADDR8~10, so 0x60000500 (bit8~10 is b101) is used as the read and write test address;
enter on the Finsh console, you can see that 0x02 is returned, proving that the EBI read data function is successful;

The write operation waveform captured on the logic analyzer is as follows:

From the read operation waveform captured by the logic analyzer, we can see that CH1-DATA1 is at a high level and the other DATA signals are at a low level, which is correct; CH11~13 is connected to ADDR8~10 signals as b101, which is correct.

Read Timing Analysis

Before performing timing analysis, we first calculate the theoretical time parameters based on the timing diagram in the official manual and the ebi initialization configuration;
1) tASU (nCS active to nRE active), the chip is fixed to 1MCLK, according to the initialization configuration MCLK = HCLK / DIV = 150M /128, so tASU = 0.853us;
2) tACC (nRE active width), according to the initialization configuration is 4MCLK, so tACC = 3.413us;
3) tAHD (nRE deactive to nCS deactive), according to the initialization configuration is 4MCLK, so tAHD = 3.413us;
Then analyze the read operation waveform captured on the logic analyzer. First, at the falling edge of nCS, the address bus is output simultaneously; after 0.875us (tASU) after the falling edge of nCS, nRE has a falling edge; the low level state of nRE continues

3.375us (tACC); 3.438us (tAHD) after nRE rises, nCS rises.
Based on the above analysis, the EBI bus read timing test is basically consistent with the official manual description (the logic analyzer has a certain error in timing due to insufficient sampling frequency).

Writing functional tests

Enter on the Finsh console

The write operation waveform captured on the logic analyzer is as follows:

From the write operation waveform captured by the logic analyzer, we can see that at the rising edge of nWE, the data bus CH0~7-DATA0~7 is b01010101 (0x55), which is correct; CH11~13 is connected to ADDR8~10 signal is b101, which is correct.

Write Timing Analysis

Before performing timing analysis, we first calculate the theoretical time parameters based on the timing diagram in the official manual and the ebi initialization configuration;
1) tASU (nCS active to nWE active), the chip is fixed to 1MCLK, according to the initialization configuration MCLK = HCLK / DIV = 150M /128, so tASU = 0.853us;
2) tACC (nWE active width), according to the initialization configuration is 4MCLK, so tACC = 3.413us;
3) tAHD (nWE deactive to nCS deactive), according to the initialization configuration is 4MCLK, so tAHD = 3.413us;
Then analyze the write operation waveform captured on the logic analyzer. First, at the falling edge of nCS, the address bus is output simultaneously; after 0.875us (tASU) after the falling edge of nCS, nWE has a falling edge; the low level state of nWE continues

3.375us (tACC); 3.438us (tAHD) after nWE has a rising edge, nCS has a rising edge.
Based on the above analysis, the test EBI bus write timing is basically consistent with the official manual description (the logic analyzer has a certain error in timing due to insufficient sampling frequency).

Compilable downloadable code

https://github.com/fever123123/Test-EBI-NK908iot.git

Experience

Compared with NUC970, the advantage of NUC980's EBI module is that the EBI module configuration function is simplified and the timing is concise; the disadvantage is that the module function is castrated, the chip select signal is reduced, and the timing configurability is reduced.

This post is from MCU
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list