Intermediate
30 min

Add DRAM memory to your design with APS6404L-3SQR and ATmega6450

Put your memory to good use!

DRAM Click with EasyAVR PRO v8

Published Mar 11, 2023

Click board™

DRAM Click

Dev Board

EasyAVR PRO v8

Compiler

NECTO Studio

MCU

ATmega6450

Secure your information with a quality DRAM memory

A

A

Hardware Overview

How does it work?

DRAM Click is based on the APS6404L-3SQR, a 64Mb PSRAM (Pseudo-SRAM) memory with an SPI/QPI interface from AP Memory. Organized as 8M x 8 bits each, this high-speed, high-performance memory has a page size of 1024 bytes. It also incorporates a seamless, self-managed refresh mechanism specially designed to maximize the performance of the memory read operation (it does not require the support of DRAM refresh from the system host). It is most suitable for low-power and low-cost portable applications.

The APS6404L-3SQR communicates with the MCU using an SPI serial interface that also supports Quad SPI and the two most common modes, SPI Mode 0 (QSPI Mode 1), with a maximum SPI frequency of 133MHz. The APS6404L-3SQR includes an on-chip voltage sensor used to start the self-initialization process. When the main power supply voltage reaches a stable level at or above the minimum supply voltage level, the device will require 150μs and user-issued RESET Operation to complete its self-initialization

process. The device powers up in SPI mode by default but can also switch to QPI mode. The CS pin must be set to high logic level before initiating any operations. This Click board™ can only be operated with a 3.3V logic voltage level. The board must perform appropriate logic voltage level conversion before using MCUs with different logic levels. However, the Click board™ comes equipped with a library containing functions and an example code that can be used as a reference for further development.

DRAM Click top side image
DRAM Click lateral side image
DRAM Click bottom side image

Features overview

Development board

EasyAVR PRO v8 is a development board specially designed for the needs of rapid development of embedded applications. It supports a wide range of microcontrollers, such as different 8/16-bit AVR® MCUs from Microchip, regardless of their number of pins, and a broad set of unique functions, such as the first-ever embedded debugger/programmer over a WiFi network. The development board is well organized and designed so that the end-user has all the necessary elements, such as switches, buttons, indicators, connectors, and others, in one place. Thanks to innovative manufacturing technology, EasyAVR PRO v8 provides a fluid and immersive working experience, allowing access

anywhere and under any circumstances at any time. Each part of the EasyAVR PRO v8 development board contains the components necessary for the most efficient operation of the same board. An advanced integrated CODEGRIP programmer/debugger module offers many valuable programming/debugging options, including support for JTAG, SWD, and SWO Trace (Single Wire Output)), and seamless integration with the Mikroe software environment. Besides, it also includes a clean and regulated power supply module for the development board. It can use a wide range of external power sources, including a battery, an external 12V power supply, and a power source via

the USB Type-C (USB-C) connector. Communication options such as USB-UART and USB DEVICE are also included, alongside the well-established mikroBUS™ standard, a standardized socket for the MCU card (SiBRAIN standard), and two display options for the TFT board line of products and character-based LCD. EasyAVR PRO v8 is an integral part of the Mikroe ecosystem for rapid development. Natively supported by Mikroe software tools, it covers many aspects of prototyping and development thanks to a considerable number of different Click boards™ (over a thousand boards), the number of which is growing every day.

EasyAVR PRO v8 horizontal image

Microcontroller Overview

MCU Card / MCU

default

Type

8th Generation

Architecture

AVR

MCU Memory (KB)

64

Silicon Vendor

Microchip

Pin count

100

RAM (Bytes)

4096

Used MCU Pins

mikroBUS™ mapper

NC
NC
AN
QSPI IO3
PG0
RST
SPI Chip Select
PG1
CS
SPI Clock
PB1
SCK
SPI Data OUT / QSPI IO1
PB3
MISO
SPI Data IN / QSPI IO0
PB2
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
QSPI IO2
PB4
PWM
NC
NC
INT
NC
NC
TX
NC
NC
RX
NC
NC
SCL
NC
NC
SDA
NC
NC
5V
Ground
GND
GND
1

Take a closer look

Click board™ Schematic

DRAM Click Schematic schematic

Step by step

Project assembly

EasyAVR PRO v8 front image hardware assembly

Start by selecting your development board and Click board™. Begin with the EasyAVR PRO v8 as your development board.

EasyAVR PRO v8 front image hardware assembly
Buck 22 Click front image hardware assembly
SiBRAIN for ATmega6450 front image hardware assembly
EasyAVR PRO v8 SiBRAIN MB 1 - upright/background hardware assembly
Necto image step 2 hardware assembly
Necto image step 3 hardware assembly
Necto image step 4 hardware assembly
NECTO Compiler Selection Step Image hardware assembly
NECTO Output Selection Step Image hardware assembly
Necto image step 6 hardware assembly
Necto image step 7 hardware assembly
Necto image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Necto PreFlash Image hardware assembly

Track your results in real time

Application Output

This Click board can be interfaced and monitored in two ways:

  • Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.

Software Support

Library Description

This library contains API for DRAM Click driver.

Key functions:

  • dram_memory_write This function writes a desired number of data bytes starting from the selected memory address.

  • dram_memory_read This function reads a desired number of data bytes starting from the selected memory address.

  • dram_memory_read_fast This function reads a desired number of data bytes starting from the selected memory address performing a fast read feature.

Open Source

Code example

The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.

/*!
 * @file main.c
 * @brief DRAM Click example
 *
 * # Description
 * This example demonstrates the use of DRAM click board by writing specified data to
 * the memory and reading it back.
 *
 * The demo application is composed of two sections :
 *
 * ## Application Init
 * Initializes the driver, resets the device and checks the communication by reading
 * and verifying the device ID.
 *
 * ## Application Task
 * Writes a desired number of bytes to the memory and then verifies if it is written correctly
 * by reading from the same memory location and displaying the memory content on the USB UART.
 *
 * @author Stefan Filipovic
 *
 */

#include "board.h"
#include "log.h"
#include "dram.h"

#define DEMO_TEXT_MESSAGE_1     "MikroE"
#define DEMO_TEXT_MESSAGE_2     "DRAM click"
#define STARTING_ADDRESS        0x012345ul

static dram_t dram;
static log_t logger;

void application_init ( void )
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    dram_cfg_t dram_cfg;  /**< Click config object. */

    /** 
     * Logger initialization.
     * Default baud rate: 115200
     * Default log level: LOG_LEVEL_DEBUG
     * @note If USB_UART_RX and USB_UART_TX 
     * are defined as HAL_PIN_NC, you will 
     * need to define them manually for log to work. 
     * See @b LOG_MAP_USB_UART macro definition for detailed explanation.
     */
    LOG_MAP_USB_UART( log_cfg );
    log_init( &logger, &log_cfg );
    log_info( &logger, " Application Init " );

    // Click initialization.
    dram_cfg_setup( &dram_cfg );
    DRAM_MAP_MIKROBUS( dram_cfg, MIKROBUS_1 );
    if ( SPI_MASTER_ERROR == dram_init( &dram, &dram_cfg ) )
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }
    
    if ( DRAM_ERROR == dram_reset ( &dram ) )
    {
        log_error( &logger, " Reset device." );
        for ( ; ; );
    }
    Delay_ms ( 100 );
    
    if ( DRAM_ERROR == dram_check_communication ( &dram ) )
    {
        log_error( &logger, " Check communication." );
        for ( ; ; );
    }
    
    log_info( &logger, " Application Task " );
}

void application_task ( void )
{
    uint8_t data_buf[ 128 ] = { 0 };
    log_printf ( &logger, " Memory address: 0x%.6LX\r\n", ( uint32_t ) STARTING_ADDRESS );
    memcpy ( data_buf, DEMO_TEXT_MESSAGE_1, strlen ( DEMO_TEXT_MESSAGE_1 ) );
    if ( DRAM_OK == dram_memory_write ( &dram, STARTING_ADDRESS, data_buf, sizeof ( data_buf ) ) )
    {
        log_printf ( &logger, " Write data: %s\r\n", data_buf );
        Delay_ms ( 100 );
    }
    memset ( data_buf, 0, sizeof ( data_buf ) );
    if ( DRAM_OK == dram_memory_read ( &dram, STARTING_ADDRESS, 
                                             data_buf, sizeof ( data_buf ) ) )
    {
        log_printf ( &logger, " Read data: %s\r\n\n", data_buf );
        Delay_ms ( 3000 );
    }
    log_printf ( &logger, " Memory address: 0x%.6LX\r\n", ( uint32_t ) STARTING_ADDRESS );
    memcpy ( data_buf, DEMO_TEXT_MESSAGE_2, strlen ( DEMO_TEXT_MESSAGE_2 ) );
    if ( DRAM_OK == dram_memory_write ( &dram, STARTING_ADDRESS, data_buf, sizeof ( data_buf ) ) )
    {
        log_printf ( &logger, " Write data: %s\r\n", data_buf );
        Delay_ms ( 100 );
    }
    memset ( data_buf, 0, sizeof ( data_buf ) );
    if ( DRAM_OK == dram_memory_read_fast ( &dram, STARTING_ADDRESS, data_buf, sizeof ( data_buf ) ) )
    {
        log_printf ( &logger, " Fast read data : %s\r\n\n", data_buf );
        Delay_ms ( 3000 );
    }
}

void main ( void )
{
    application_init( );

    for ( ; ; )
    {
        application_task( );
    }
}

// ------------------------------------------------------------------------ END

Additional Support

Resources

Love this project?

'Buy This Kit' button takes you directly to the shopping cart where you can easily add or remove products.