S32K144 ADC Slow Sample Rate in FreeMaster

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

S32K144 ADC Slow Sample Rate in FreeMaster

1,847 Views
sparkee
Contributor V

I never got an answer as to why FreeMaster won't show a sample rate faster than ~1ms.  I've tried both PDB and ISR reads and get a similar sample rate.  I've recorded the data to file and it's no different. 

I'm only reading a single ADC channel (I've also tried with 2 and no difference).  I've tried with and without hardware averaging.  FreeMaster won't connect when hardware averaging is set to 32 samples, but the rest show no difference that I can see. 

The only thing that made a noticeable difference to me was changing the sample time down to 2 from around 15.  That definitely made a small difference. 

I know FreeMaster is capable of faster reading and I know the hardware is capable so it must be something I'm doing wrong in the setup.  Any help will be greatly appreciated.

I'm using S32K144EVB and FreeMaster 3.0.  I have fixed step size set to 0.00001 (also tried at 0.0001).

I'm feeding the ADC a 60Hz sine wave that has been rectified and is a few hundred millivolts peak.

pastedImage_5.pngpastedImage_6.png

PDB triggers every 0.1ms

No hardware averaging

pastedImage_1.png

Hardware averaging 8 samples

pastedImage_3.png

Changed ADC sample time from 15 down to 2 and saw a change.

pastedImage_4.png

8 Replies

1,576 Views
mariuslucianand
NXP Employee
NXP Employee

Hello sparkee‌,

We had a look on your model, together with iulianstan‌ and adriantudor‌, and have the following suggestions:

1. You can increase the baud rate up to 256000, but you will not get a very accurate sine wave over it. What we got is the following sine in the scope for a signal of 60Hz. 

pastedImage_2.png

2.  For precise measurement, you can use the Recorder. Basically, it will use a buffer in which it will store the measured values converted by the ADC and will transfer the whole "recorder" values at once. What is nice is that you can store all the values, together with the timestamp in a .txt file, that I have also attached. You can see the stored data at every 0.0001 s recorder, and you can also get lower sample rates. We've added the Recorder block inside the 0.1ms Thread. 


0.002700 0
0.002800 4
0.002900 14
0.003000 25
0.003100 40
0.003200 59
0.003300 77

pastedImage_1.png

What you need to do is to add this block whenever you need to store the data. The max allowed buffer size is 1024 bytes, so now, for an uint32_t data type we will display only 256 points. Also, the ADC returns data in uint32_t so you can convert that to uint16_t and transfer at double size.

pastedImage_2.png

If you go to the Recorder properties and  add the variable that you are interested in, you also need to specify a Trigger Mode and level which will trigger the beginning od the recorder. 

pastedImage_3.pngpastedImage_4.png

Hope this helps,

Marius

1,576 Views
sparkee
Contributor V

I'm able to see the data as you described, thank you again. 

I am now having trouble when adding a tapped delay subsystem.  I get an error saying no communication with the board.  If I remove the subsystem, FreeMaster begins working again.  I get the same error if I use hardware averaging at 8 samples or above.  It will work at 4 samples however. 

0 Kudos

1,577 Views
mariuslucianand
NXP Employee
NXP Employee

Hello sparkee‌,

I think the timings in that model are quite tight. Let's try reducing the step time from 0.0001 to lower and try something like that 0.01 since you are not doing much on the step function.

Hope this helps,

Marius

0 Kudos

1,577 Views
sparkee
Contributor V

Thank you for your detailed response.  I must have been using the recorder incorrectly last time because my signal did not look smooth like yours.  I will try again with your suggestions.  Just having confirmation that my ADC is reading faster than what I see on the screen is great though.  I can now focus on the rest of the model without worry!

Thank you again Marius-lucian Andrei

1,577 Views
mariuslucianand
NXP Employee
NXP Employee

Hello sparkee‌,

Can you please attach the .slx and not the .slxc file?

Regards,

Marius

1,578 Views
sparkee
Contributor V

Ooops!

1,578 Views
mariuslucianand
NXP Employee
NXP Employee

Hi sparkee‌,

Indeed I remember the previous thread (https://community.nxp.com/thread/526102 ) where we've tested the ADC conversion capabilities of the S32K board, and the suggestion then was to use the recorder functionality of the FreeMasster. So, just to resume the issue, the ADC conversion looks good, but you need to transfer faster the converted data from the board over FreeMASTER‌.

So once again I'll ask my colleague iulianstan to share his opinion in this use case!

Hope this helps,

Marius

0 Kudos

1,578 Views
sparkee
Contributor V

Yes I used the recorder functionality and got similar results.  Even if the recorder functionality worked and gave me faster reads, that wouldn't explain why I can get a faster update to my screen.  In a recent webinar it was said that display speeds should be in the microseconds.  I'm running a 1 year old machine with a Xeon processor and 16GB of memory so I doubt it's a processing issue. 

I don't think I mentioned this but I'm using the short interrupt mode.  I also tried polling and long interrupt and did not see an improvement.   I don't think polling actually worked but I'm not 100% on that.  I'm also connecting at 115Kbps.

Thank you

0 Kudos