Simple incremental counter(s)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Simple incremental counter(s)

Jump to solution
1,983 Views
chrisc1
Contributor III

Good afternoon.

Is there any specific documentation explaining the best practice for implementing incremental counting (in seconds or ticks for example) in the MBDT and the S32K144?

When connecting with FreeMASTER to the S32K144 I get some different results to what I get in simulation and what I had in other processors. The value is static and does not increase.

Maybe this could be to do with the properties in the Data Store Write / Memory blocks or some properties during import of the symbols from ELF into FreeMASTER?

I have attached a model and some screenshots. There might be other way you can recommend to count up. For me the simplest is to use a sum block with one input connected to the previous operation value. Maybe I'm doing something very basic wrong but it's the same code I've used on a TC1793 and MPC5554.

Thank you

Tags (1)
1 Solution
1,810 Views
chrisc1
Contributor III

Hi mariuslucianandrei,

yes so reprogramming the OpenSDA "seems" to fix the issues. I am able to program the board successfully via Simulink so I will monitor if the 8x blinking occurs again as a consequence of any flashing operation.

Thank you for the explanation below (and the instruction to browse within the debugger) which I have added to our documentation on the EVB.

View solution in original post

10 Replies
1,810 Views
chrisc1
Contributor III

I think my issue looks to be the 8-times blinking LED near the SDA chip. I'm not having much luck with S32K144. This is the second EVB that is very sensitive.

0 Kudos
1,810 Views
mariuslucianand
NXP Employee
NXP Employee

Hello chrisc@rmlgroup.com‌,

The project you have sent me seems to work on my board.

If the red Led next to RESET button always on?

pastedImage_1.png

1,810 Views
chrisc1
Contributor III

Thank you Marius,

yes I believe the code is fine actually. I had noticed that on the board the LED next to the SDA chip is flashing repeatedly 8 times. Is there a procedure that can "reclaim" the board to usable status? I was seeing strange values and also the rotary pot was not giving feedback so initially I thought my code was wrong but then I saw some posts in the forum that when the 8x blinking happens, the debug or SDA is not working correctly. I don't have a JTAG debugger with me so I am relying on USB to work all of the time. Is there any procedure I can follow that does not involve debugger + S32DS?

Thank you

0 Kudos
1,810 Views
mariuslucianand
NXP Employee
NXP Employee

Hello chrisc@rmlgroup.com‌,

Well if the led next to OpenSDA is blinking 8 times then there is an error in communication between the OpenSDA and MCU.

1. Please check the jumper J107 (2-3 position to be powered up from the USB). If the MCU is powered up, the led D3 should be turned on.

2. The beauty of the OpenSDA is that it can be used as a JTAG. So you can flash/debug the board using the OpenSDA and S32DS.

pastedImage_1.png

3. You can update the OpenSDA firmware as in the procedure described already to you in my first response of this thread: S32K144EVB not recognised by USB after 2+ hours of correct behaviour 

4. If the led D1 is continuously turned on red, then the board is a continuously reset state and the procedure from this thread https://community.nxp.com/thread/535612 , using the Kinetis Recovery tool must be applied.

Hope this helps,

Marius 

0 Kudos
1,810 Views
chrisc1
Contributor III

Hi Marius,

ok so I managed to open the GUI window that you show in screenshot; I also clicked on the flash icon on the top menu bar to flash the Project_hello. I am not a habitual user of S32DS so at the moment I don't completely know my way around the full software.

The LED is still blinking multiple times, so I am not sure if flashing from S32DS is going to fix that. If it does not, then could anyone provide links to documentation to flash my other binary/ELF files for the builds I did? I've created a project but don't know how to point it to the files.

In any case, for me it is 100% important to have the USB functioning so I can use FreeMaster.

The USB driver stability of these boards is strange: 1st board corrupted its SDA chip (replaced by Farnell), 2nd board 8x LED blink on monday, 3rd board 8x blink today afternoon. All my Simulink code is relatively simple and each board was flashed via USB maybe 20 times. In fact this last board went into the SDA fault mode when I was putting back on to it a demo NXP build (buttons to LED function); I did not put any strange hacky code etc.

S32K144_Flashing.JPG

0 Kudos
1,810 Views
mariuslucianand
NXP Employee
NXP Employee

Hello chrisc@rmlgroup.com‌,

Just to clarify some things here:

The LED is still blinking multiple times, so I am not sure if flashing from S32DS is going to fix that. If it does not, then could anyone provide links to documentation to flash my other binary/ELF files for the builds I did? I've created a project but don't know how to point it to the files.

The Model-Based Design Toolbox for S32K generates the code and then compiles the generated code, resulting a .elf file. From this .elf file it then generates a .mot file and copies this .mot file to the OpenSDA. The OpenSDA takes this file and flashes the controller with over SWD.

If you need to debug or program the generated code, you can import the .elf file in the Debug Configuration or S32DS and once you selected a valid project for your board (I am using the hello_world_s32k144 provided by the SDK) you can press browse and select the desired .elf file. It will flash the file that appears in the c/C++ Application field

pastedImage_10.png

Another possibility is to import the whole generated code in the S32DS, ONLY if you need to debug or so, but just for flashing is not necessary. 

In any case, for me it is 100% important to have the USB functioning so I can use FreeMaster.

OpenSDA uses for flashing the SWD protocol and dedicated pins connections [2]. The FreeMaster communicates over the Serial and uses the OpenSDA as a USB to Serial converter on pins [1]. OpenSDA can't be used as flashing tool and as USB to serial at the same time, even if there are different pins. But once the program has been flashed, you can use the Serial no matter which method of flashing you have used: copy paste the .mot file or S32DS.

pastedImage_11.png

Hope this helps,

Marius

0 Kudos
1,810 Views
chrisc1
Contributor III

The board is recoverable by putting it into boot mode and reloading the MSD-DEBUG-EVB-S32K144_Pemicro_v119.SDA.

I hope that if it happens again I can always follow that procedure.

Thank you for the help

0 Kudos
1,810 Views
mariuslucianand
NXP Employee
NXP Employee

Hello chrisc@rmlgroup.com‌,

So, reprogramming the OpenSDA solved all the issues?

Marius

0 Kudos
1,811 Views
chrisc1
Contributor III

Hi mariuslucianandrei,

yes so reprogramming the OpenSDA "seems" to fix the issues. I am able to program the board successfully via Simulink so I will monitor if the 8x blinking occurs again as a consequence of any flashing operation.

Thank you for the explanation below (and the instruction to browse within the debugger) which I have added to our documentation on the EVB.

1,810 Views
mariuslucianand
NXP Employee
NXP Employee

Hi chrisc@rmlgroup.com‌,

Nice to hear that!

Marius

0 Kudos