cancel
Showing results for 
Search instead for 
Did you mean: 

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

PDobr.1
Associate III

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

1 ACCEPTED SOLUTION

Accepted Solutions
PDobr.1
Associate III

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. 

View solution in original post

18 REPLIES 18
TLLAM.1
ST Employee

Hi Paul

Thanks for reaching out the ST community.

The NUCLEO-PGEEZ1 should be compatible with the L476RG as the F401.

Did you check the data size in the SPI parameters setting (CubeMx) than can be different from L476RG and F401 ? Please see the image attached.

I'm not sure it's going to solve your problem but I think a quick check is worth it.

I'm going to warn our software development team regarding your issue in parallel to see if another possibilities exist.

Thanks,

Best regards,

Thomas.

PDobr.1
Associate III

Thank you Thomas for your answer. You have mentioned about data size, that was the first what I checked,after I saw, that it didnt work, it didnt help - please see the image attached.

I will describe the topic more precisely.

When PGEEZ1 is dissconnected form STM32L476 NUCLEO(I think it happenes also with STM32F401 NUCLEO), after running the software, on USART monitor appears this:

        ______Test 1 Starts______

    Test case to verify Write Enable and Write Disable

00   : Passed 

00   : Failed 

00   : Passed 

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

        ______Test 2 Starts______

    Test case to verify Page Write and Read

 Write Page               : Failed

    **************Test 2 Failed**************

and that's all, everything stops. So, user might think, that something is ok, but there is not. I know what should be displayed when everything is ok, because I've tried to run github resources, from that (with Nucleo F401)::

https://github.com/STMicroelectronics/X-CUBE-EEPRMA1

So, going further, let me explain, what problems happen, when you are going to focus on L476 board.

There are two scenarios (with connected X-NUCLEO_PGEEZ1 to NUCLEO L476):

  1. You are launching STM Cube IDE, next you chose bord L476 in board selector, and init all in default mode. Next, you are going to X-CUBE-EEPREMA1, where first proplems appear. Look at the photos.


_legacyfs_online_stmicro_images_0693W00000bkLlXQAU.png
_legacyfs_online_stmicro_images_0693W00000bkLlmQAE.png 


_legacyfs_online_stmicro_images_0693W00000bkLm1QAE.pngand now - after setting the SPI2 and GPIO's, it everything looks linke that:


_legacyfs_online_stmicro_images_0693W00000bkLlIQAU.pngSo -there is no way to use PGEEZ1 in proper way.

.2. And now second aproach. First - after chosing the microcontroller L476 (not Nucleo, because in Nucleo we have PA5 GPIO acting as a LED, on F401 is also LED connected to PA1, but the github example runs correctly) board and initalising everything, we don't go directly to X-CUBE-EEPREMA1 in Cube, but first - we set up SPI and GPIO's:


_legacyfs_online_stmicro_images_0693W00000bkMBLQA2.pngthan we go to X-CUBE_EEPREMA1 and we see, that also this time nothing can be configured, there are still errors.:


_legacyfs_online_stmicro_images_0693W00000bkMF8QAM.png 

but if we will unmark Board Part EEPROM--> MP95P32/MP95P32 option, and mark only Board Extension EEPRM--> PGEEZ1 option, we will see green signs, that everything is ok:


_legacyfs_online_stmicro_images_0693W00000bkMEyQAM.pngso we might think, that probably everything should go right, after cofiguring nessesary things in PGEEZ1:


_legacyfs_online_stmicro_images_0693W00000bkMHOQA2.pngBut after running the code (no errors), we see that on the USART2:

        ______Test 1 Starts______

    Test case to verify Write Enable and Write Disable

ff   : Failed 

ff   : Failed 

ff   : Failed 

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

        ______Test 2 Starts______

    Test case to verify Page Write and Read

So maybe something was done wrong... Any advice?

The same approach in F401 gives also no effect, but when we use GITHUB resources (from link at the beggeining) - everything runs properly on F401 (there is no github example for L476).

The effect is the same (using only CUBE) for the Nucleo's L476 and F401, so I think, if someone will run the PGEEZ1 by cube with success on F401, there will be no problems with running it (by CUbe) on other bards, for example on L476.

Any ideas how to do it? The juimpers are set correctly (J9-J15, according documentation).

TLLAM.1
ST Employee

Hi Paul

Thank you very much for you detail answer.

Sorry for my delayed response, we were in public holidays.

I'm going to investigate with the new elements you brought and give you a feedback as soon as possible.

Best Regards,

Thomas

TLLAM.1
ST Employee

Hi Paul

The software development team was able to run the NUCLEO-PGEEZ1 on STM32L476RG NUCLEO board.

Please find attached a PDF file for the STM32CubeMX configuration.

Do you mind following these steps and run the project ?

Thanks

Thomas

PDobr.1
Associate III

Your answer solved the problem. I must admitt, everything I did before, was almost right. I didn't put the PA5 to reset state (first mistake), and the settings of PA9, PB0 and PB6 was a little bit different (3rd column, there was Low instead of High). And the "GPIO OUTPUT LEVEL" column was the cause of problems, after changing it to "Low" - the project doesn't run poperly. When I change that parameter to HIGH, everything is fine.

Also, another lesson to learn, thank you for helping me and hope, next user with the same problem will read this thread and use the info.

But I want to ask about another issue, After succesfull start of the project, on the terminal appears this:

 Enter cmd :

I understand, the app wants me to write the command. Were are the commands listed, to write in that line?

Hi Paul,

That's a great news. Indeed you did almost perfectly !

To answer your question about "Enter cmd" :

Here you can directly send SPI command through you terminal interface. If you download the M95P32 datasheet you will find page 21 the product instruction list :

https://www.st.com/resource/en/datasheet/m95p32-i.pdf

In the Hex code column you have the hexadecimal code to send through you terminal.

For instance if I type 5 , it will send the Read status register instruction and give you the following result :

Enter cmd :

5

__READ_STATUS_REG__

00

==> So the 8 bits of the status registers are at 0.

If you want to read something you can go like this : 3 00 5

Enter cmd :

3 00 5

 Read data Add: 000000:

 aa aa aa aa aa

==> 3 is the READ instruction

==> 00 is the start address

==> 5 is the number of byte you want to read

If you want to write something you can go like this :

 Enter cmd :

2 200 100 55

==> 2 is the WRITE instruction

==> 200 is the start address

==> 100 is the number of byte you want to write

==> 55 is the pattern you want to write

note : if you write don't forget to sent a Write enable instruction before with ;

Enter cmd :

6

__WRITE_ENABLE__

I hope these few examples would help you.

Best regards,

Thomas

PDobr.1
Associate III

Yes, that helped much. So, i think it should definitely close the topic, everything works properly. Thanks

PDobr.1
Associate III

Hallo again. I hoped, there will be no more problem with M95P32, but there is one issue, that is worth to mention.

After some simple tests, suddenly the PGEEZ1/M95P32 stopped to respond. Right now the situation is the same, as at the beggining - its a big suprise for me and I cant find a solution. So, below is terminal copy of current state:

    ______Test 1 Starts______

    Test case to verify Write Enable and Write Disable

00   : Passed 

00   : Failed 

00   : Passed 

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

        ______Test 2 Starts______

    Test case to verify Page Write and Read

 Write Page               : Failed

    **************Test 2 Failed**************

There were no electrical changes between states, when the board was working properly and now, when the board is not responding. There were also not significiant code change.

So what have I done? As far, as I remember, i wrote in main while loop command to simple write part some sectors, like that:

 /* Initialize all configured peripherals */

 MX_GPIO_Init();

 MX_SPI1_Init();

 MX_EEPROM_Init();

 /* USER CODE BEGIN 2 */

 /* USER CODE END 2 */

 /* Infinite loop */

 /* USER CODE BEGIN WHILE */

 while (1)

 {

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

  /* USER CODE END WHILE */

 MX_EEPROM_Process();

  /* USER CODE BEGIN 3 */

 }

 /* USER CODE END 3 */

}

I don't remember if I was trying to write 1000 pages or 10000. The effect is not good, after programming, the memory behaves like unplugged from SPI.

I have second PGEEZ1 and few otherts Nucleo. After this happened, I took second (fresh) PGEEZ1 and run the Github example (F401+PGEEZ1), it worked fine. So, next, I was training with write page commands (from code, not from terminal), and it happened the same. After restoring the code to original (working github example) state, the board (PGEEZ1) didnt worked, it behaved like not connected. SPI interface in Nucleo-L401 (F476) was ok.

Assuming - the PGEEZ1 behaves like unpluuged, So - few questions.

Is possible state, when M95P32 is permamently blocked? Or maybe just blocked?

Because I don't remeber exactly, what code I wrote, is there a way to block the EEPROM? If yes, how?

And what interesting me the most:

How to make it work again?

What series of commands/instructions should be provided, to make it work?

Hi Paul,

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

The SPI inteface is already initialized in the MX_EEPROM_Init().

Do you have an other device on the SPI bus to use the MX_SPI1_Init()?

Secondly, 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..

So you should loop like this to write 1000 pages:

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

The M95P32_PAGESIZE variable is defined as 512 in the software package

Finally when the M95P32 stalls you have 3 possibilities :

Software reset

Deep power-down enter/release

Power-down/up

One one these three actions should bring back the device in a reset state as detailed in the datasheet (page 13, Section 4.9 Device Reset)

I hope this will help

Best regards,

Thomas