SQI FLASH CLICK

General discussion on mikroC PRO for PIC32.
Post Reply
Author
Message
djk963
Posts: 4
Joined: 07 Nov 2018 21:35

SQI FLASH CLICK

#1 Post by djk963 » 20 Aug 2019 09:39

greeting ...
I'm a beginner in MIKROE World :) but
I have EASYPIC FUsion V7 with P32MX795F512L MCU.. i have download the SQI FLASH Library and try to use the example and modify it just to see what i have wrote on the flash and display it on easyTFT display.. unfortunately i cant see anything displayed on the TFT. i tired to see what i have done wrong but still no luck .. any idea please!

this is what i have done so far


#include <built_in.h>
#include "Click_SQI_FLASH_types.h"
#include "Click_SQI_FLASH_config.h"
char TFT_DataPort at LATE;
sbit TFT_RST at LATD7_bit;
sbit TFT_BLED at LATD2_bit;
sbit TFT_RS at LATD9_bit;
sbit TFT_CS at LATD10_bit;
sbit TFT_RD at LATD5_bit;
sbit TFT_WR at LATD4_bit;
char TFT_DataPort_Direction at TRISE;
sbit TFT_RST_Direction at TRISD7_bit;
sbit TFT_BLED_Direction at TRISD2_bit;
sbit TFT_RS_Direction at TRISD9_bit;
sbit TFT_CS_Direction at TRISD10_bit;
sbit TFT_RD_Direction at TRISD5_bit;
sbit TFT_WR_Direction at TRISD4_bit;


static void InitializeTouchPanel() {
AD1PCFG = 0xFFFF;
JTAGEN_bit = 0;
TFT_BLED_Direction = 0;
TFT_Init_ILI9341_8bit(320, 240);
TFT_BLED = 1;
}

void systemInit()
{
mikrobus_gpioInit( _MIKROBUS1, _MIKROBUS_CS_PIN, _GPIO_OUTPUT );
mikrobus_spiInit( _MIKROBUS1, &_SQIFLASH_SPI_CFG[0] );

mikrobus_logInit( _LOG_USBUART_A, 9600 );

Delay_ms( 100 );
}

void applicationInit()
{
sqiflash_spiDriverInit( (T_SQIFLASH_P)&_MIKROBUS1_GPIO, (T_SQIFLASH_P)&_MIKROBUS1_SPI );
mikrobus_logWrite( "Initialized", _LOG_LINE );
Delay_ms( 200 );
}

void applicationTask()
{
uint8_t counter;
uint8_t result = 0;
char txt[20] = {0};


SQIFLASH_WriteByte(counter, counter);
//mikrobus_logWrite( "Value Written : ", _LOG_TEXT );
ByteToStr( counter, txt );
//mikrobus_logWrite( txt, _LOG_LINE );
Delay_ms( 100 );

result = SQIFLASH_ReadByte(counter);
//mikrobus_logWrite( "Value Read : ", _LOG_TEXT );
ByteToStr( result, txt );
// mikrobus_logWrite( txt, _LOG_LINE );
TFT_Fill_Screen(CL_WHITE);
TFT_Set_font(TFT_defaultFont,CL_Black,FO_Horizontal);
TFT_Write_Text(txt,10,45);
Delay_ms( 100 );

counter++;

if (counter == 256)
{
counter = 0;
}
Delay_ms( 2000 );
}

void main()
{
InitializeTouchPanel();
systemInit();
applicationInit();

while (1)
{
applicationTask();
}
}
Attachments
ZIP_SQI.zip
(359.87 KiB) Downloaded 68 times

User avatar
stefan.filipovic
mikroElektronika team
Posts: 1135
Joined: 18 Dec 2018 10:30

Re: SQI FLASH CLICK

#2 Post by stefan.filipovic » 21 Aug 2019 14:37

Hi,

In order to use this click board with regular SPI interface, SQ2 (RD0) and SQ3 (RC1) pins must be set to HIGH logic level, as described on the product page:

When configured to work in a regular SPI mode, the SQ2 and the SQ3 pins will become Write Protect function and Hold function pins:

SQ2 - Setting this pin to a LOW logic state and the WPEN bit to 1, enables hardware write-protection. To disable hardware write protection, either the SQ2 pin should be set to a HIGH logic level, or the WPEN bit to should be set to 0.

SQ3 - Setting this pin to a LOW logic state will temporarily hold the serial communication, while the device is selected by the CE pin. When using this feature during the memory transfer, access times can be significantly reduced, since the device does not have to wait cycles to be addressed by the CE pin, which is the case when it is fully stopped. Once selected by the CE, the transfer can be started or stopped instantaneously at any moment. This pin must be pulled up HIGH while not in use.


Kind regards,
Stefan Filipović

Post Reply

Return to “mikroC PRO for PIC32 General”