Skip to main content
PDobr.1
Associate II
May 17, 2023
Solved

How to run NUCLEO-PGEEZ1 on NUCLEO-L476RG board?

Hallo, since few days I am trying to run X-NUCLEO_PGEEZ1 board on NUCLEO-L476. I know, that:

  • github example can be downloaded, but the exaple is for NUCLEO-F401, not for L476.
  • Cube can generate code for PGEEZ1 and L476, but there are some errors durig code generation from graphical interface,

I have tried everything (L476), changing SPI's for others, changing speed of SPI, other parameters, also connecting the board with separate wires (SPI2, SPI3). Nothing works correctly. (I know what sould be displayed, because I know how this PGEEZ1 sould work on f401 - I have run it with success).

On USART monitor I see only, that:

  ______Test 1 Starts______

 

    Test case to verify Write Enable and Write Disable

20   : Failed 

00   : Failed 

00   : Passed 

    **************Test 1 Passed**************

 

        ______Test 2 Starts______

    Test case to verify Page Write and Read

 

Maybe someone can give me an advice?

Regards, Paul

This topic has been closed for replies.
PDobr.1
PDobr.1Best answer
Associate II
June 20, 2023

After some research, I think, that the problem is on my site. Copying binary file to F401 Nucleo with PGEEZ1 example makes it work properly. Compiling prepared project to F476 (there is no binary file to copy from ST) and adding some lines of code (for init and further testing) makes it work also. Here are the lines from main.c:

#include "main.h"
#include "app_x-cube-eeprma1.h"

/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include "m95p32.h"
#include "pgeez1_m95p32.h"
/* USER CODE END Includes */

/* Private typedef -----------------------------------------------------------*/
/* USER CODE BEGIN PTD */

/* USER CODE END PTD */

/* Private define ------------------------------------------------------------*/
/* USER CODE BEGIN PD */

/* USER CODE END PD */

/* Private macro -------------------------------------------------------------*/
/* USER CODE BEGIN PM */

/* USER CODE END PM */

/* Private variables ---------------------------------------------------------*/
SPI_HandleTypeDef hspi2;

/* USER CODE BEGIN PV */
uint8_t EEBuff[512];
uint8_t EEBuffRx[512];
uint16_t adress = 0;
int32_t retval32;
/* USER CODE END PV */

/* Private function prototypes -----------------------------------------------*/
void SystemClock_Config(void);
static void MX_GPIO_Init(void);
static void MX_SPI2_Init(void);
/* USER CODE BEGIN PFP */

/* USER CODE END PFP */

/* Private user code ---------------------------------------------------------*/
/* USER CODE BEGIN 0 */

/* USER CODE END 0 */

/**
* @brief The application entry point.
* @retval int
*/
int main(void)
{
/* USER CODE BEGIN 1 */

/* USER CODE END 1 */

/* MCU Configuration--------------------------------------------------------*/

/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();

/* USER CODE BEGIN Init */

/* USER CODE END Init */

/* Configure the system clock */
SystemClock_Config();

/* USER CODE BEGIN SysInit */

/* USER CODE END SysInit */

/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_SPI2_Init();
// MX_EEPROM_Init();
/* USER CODE BEGIN 2 */
BSP_COM_Init(COM1);
while( PGEEZ1_M95P32_Init(PGEEZ1_M95P32_0)!= M95_OK); printf("\n\rInitiated ...");
retval32 = PGEEZ1_M95P32_WriteEnable(); printf("\n\rWrite Enabled...");
retval32 = PGEEZ1_M95P32_WritePage(0, EEBuff, adress, 512); printf("\n\rWrite OK ...");
retval32 = PGEEZ1_M95P32_ReadPage(0, EEBuffRx, adress, 512); printf("\n\rRead ...");
for (int i = 0; i<512; i++) if (EEBuff[i] != EEBuffRx[i]) printf("\n\rERROR");
printf("\n\rRead OK ...\n\r");
/* USER CODE END 2 */

/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */

//MX_EEPROM_Process();
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
}

 

So - I the issue is solved. 

18 replies

PDobr.1
PDobr.1Author
Associate II
May 26, 2023

Hallo again. I am very sorry for my late answer. I didn't answer for your first and second thought.

Ok - you wrote:

" I don't catch why you have the MX_SPI1_Init() and the MX_EEPROM_Init(). "

MX_EEPROM_Init() adds automaticaly, when Cube generates code for PGEEZ1 example. MX_EEPROM_Init() is code from file app_x-cube-eeprma1.c

void MX_EEPROM_Init(void)

{

 MX_EEPROM_RW_Init();

 IntroScreen();

}

Answer for second question: You wrote:

"when I look at your for loop :

for (i = 0; i<1000; i++) PGEEZ1_M95P32_WritePage(0, data_buff, i, 512);

 You are currently writing 512 bytes at address 0, 1, 2, 3... instead of writing at address 0, 512, 1024, 1536.."

Of course, you are right. My mistake, Comes from bad habbits with older kind of memories, where you adressed only pages and recorded whole page instead of bytes... I Didn't read properly the datasheet.

Anyway, there is no reason to expect, that after reset, the M95P32 will not start, even with reference code.

TLLAM.1
ST Employee
May 29, 2023

Hi Paul,

I suggest you to send me the Nucleo board PGEEZ1. As you said there is no reason to expect the M95P32 not to work after a reset.

With your board I will be able to investigate much more easily.

My address is the following :

Thomas Llamazares

STMicroelectronics (Rousset) SAS,

190 avenue Celestin Coq, CS 60004 | 13106 ROUSSET | FRANCE

Thanks,

Thomas

PDobr.1
PDobr.1Author
Associate II
May 29, 2023

I thought, that this issue will finalise with that proposal you made. Ok - before sending the boards to you, maybe you have any suggestions - to make the board work? Or some advices to search the problems by myself.

Because the scenario of stopping the proper work of that (two) boards was completly unexceptable for me (the boards stopped to work without reason, the code was the same moment before malfunction and there was no mechanical interference) - I start to think, that the device has a bug.

I will search for the problem a little, when I will find, I will share with community.

TLLAM.1
ST Employee
May 29, 2023

Hi Paul,

It is hard for me to solve the issue from distance. Maybe you can share some data like oscilloscope screenshot when you attempt to send data through the SPI bus.

We can also have a call if necessary.

Thomas

PDobr.1
PDobr.1Author
Associate II
May 29, 2023

Good - I will try the oscliloscope option.

PDobr.1
PDobr.1AuthorBest answer
Associate II
June 20, 2023

After some research, I think, that the problem is on my site. Copying binary file to F401 Nucleo with PGEEZ1 example makes it work properly. Compiling prepared project to F476 (there is no binary file to copy from ST) and adding some lines of code (for init and further testing) makes it work also. Here are the lines from main.c:

#include "main.h"
#include "app_x-cube-eeprma1.h"

/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include "m95p32.h"
#include "pgeez1_m95p32.h"
/* USER CODE END Includes */

/* Private typedef -----------------------------------------------------------*/
/* USER CODE BEGIN PTD */

/* USER CODE END PTD */

/* Private define ------------------------------------------------------------*/
/* USER CODE BEGIN PD */

/* USER CODE END PD */

/* Private macro -------------------------------------------------------------*/
/* USER CODE BEGIN PM */

/* USER CODE END PM */

/* Private variables ---------------------------------------------------------*/
SPI_HandleTypeDef hspi2;

/* USER CODE BEGIN PV */
uint8_t EEBuff[512];
uint8_t EEBuffRx[512];
uint16_t adress = 0;
int32_t retval32;
/* USER CODE END PV */

/* Private function prototypes -----------------------------------------------*/
void SystemClock_Config(void);
static void MX_GPIO_Init(void);
static void MX_SPI2_Init(void);
/* USER CODE BEGIN PFP */

/* USER CODE END PFP */

/* Private user code ---------------------------------------------------------*/
/* USER CODE BEGIN 0 */

/* USER CODE END 0 */

/**
* @brief The application entry point.
* @retval int
*/
int main(void)
{
/* USER CODE BEGIN 1 */

/* USER CODE END 1 */

/* MCU Configuration--------------------------------------------------------*/

/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();

/* USER CODE BEGIN Init */

/* USER CODE END Init */

/* Configure the system clock */
SystemClock_Config();

/* USER CODE BEGIN SysInit */

/* USER CODE END SysInit */

/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_SPI2_Init();
// MX_EEPROM_Init();
/* USER CODE BEGIN 2 */
BSP_COM_Init(COM1);
while( PGEEZ1_M95P32_Init(PGEEZ1_M95P32_0)!= M95_OK); printf("\n\rInitiated ...");
retval32 = PGEEZ1_M95P32_WriteEnable(); printf("\n\rWrite Enabled...");
retval32 = PGEEZ1_M95P32_WritePage(0, EEBuff, adress, 512); printf("\n\rWrite OK ...");
retval32 = PGEEZ1_M95P32_ReadPage(0, EEBuffRx, adress, 512); printf("\n\rRead ...");
for (int i = 0; i<512; i++) if (EEBuff[i] != EEBuffRx[i]) printf("\n\rERROR");
printf("\n\rRead OK ...\n\r");
/* USER CODE END 2 */

/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */

//MX_EEPROM_Process();
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
}

 

So - I the issue is solved.