Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 04:34 29 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : PicoMite V5.07.06 preview - flash file system

     Page 5 of 5    
Author Message
Tinine
Guru

Joined: 30/03/2016
Location: United Kingdom
Posts: 1646
Posted: 10:13am 20 Dec 2022
Copy link to clipboard 
Print this post

  JohnS said  
In the overall realm of computing I think it would hardly ever be used
John


De facto standards tend to be used quite a bit.


Craig
 
Tinine
Guru

Joined: 30/03/2016
Location: United Kingdom
Posts: 1646
Posted: 11:28am 20 Dec 2022
Copy link to clipboard 
Print this post

  TassyJim said  
re 1200 baud for updating.
That is how MMCC does it. Simply connect to your target system, drag a *.uf2 file onto MMCC and sit back.
Note: with my W11, I cannot drag from a ZIP. The file has to be extracted first.

Jim


Very slick  
Yeah, I had to extract first (W10)

Many thanks Jim  
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3814
Posted: 12:23pm 20 Dec 2022
Copy link to clipboard 
Print this post

  Tinine said  
  JohnS said  
In the overall realm of computing I think it would hardly ever be used
John


De facto standards tend to be used quite a bit.

Craig

In the kinds of things you do, yes.

Overall in computers, MODBUS just isn't. And a software CRC is hardly a problem with today's fast CPUs.

Ideal for a CSUB, most likely, if even needed to be so fast. (On such as a Pico, a lookup table could be used to help it be faster if coded in MMBasic - again, if needed.)

Of course if Peter feels flash space can be used up for it, no problem.

John
Edited 2022-12-20 22:24 by JohnS
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4253
Posted: 12:31pm 20 Dec 2022
Copy link to clipboard 
Print this post

Hi Peter,

About the CRC. I envision following format


 CRC16% = MATH CRC A,B


Where A is an array of data, simplest is to support only a string (array of uint8). When choosing integers, you need al kinds of conversions to make sure you are not CRC'sin leading zero's when 16 bit integers are stored in 64bit variables.

Where B is an array with CRC configuration parameters. B can be omitted using MODBUS (CRC16-IBM). The array contains the following (directly mapped onto the arduino library).
DIM conf%(4)=(Polynomal, XORstart, XORend, RevIn, RevOut)

For MODBUS:
Polynomal = &h8005
XORstart = 0 (boolean)
XORend = 0 (boolean)
RevIn = 0 (boolean)
RevOut = 0 (boolean)

Info:
Wiki
library
Online check

IS this what you wanted me to do ? Or did I misunderstand the question ?

Volhout
PicomiteVGA PETSCII ROBOTS
 
Tinine
Guru

Joined: 30/03/2016
Location: United Kingdom
Posts: 1646
Posted: 12:49pm 20 Dec 2022
Copy link to clipboard 
Print this post

@Volhout: JohnS has a point...have you tried the captain's look-up table method on FoTS?

Craig
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4253
Posted: 01:21pm 20 Dec 2022
Copy link to clipboard 
Print this post

Hi All,

Yes, I have looked at Captains lookup table method.

Let me explain: a turn-around time is the time between end of the command message and the start of the response message. In this timeframe, you have to decode the command message, after checking CRC (calculating CRC). Generate the response, the response CRC, and start sending the response.

So you need 2 CRC generations, and some basic decoding of the message. In 1 ms. Unless you are multitasking, then you can do the CRC calculations during other tasks.

Some numbers on picomite (test string = "hello").

CRC16-CCITT :            7ms
CRC16-IBM (modbus) :    12ms
CRC16-IBM table method:  1.7ms

The table method is much faster, but just not fast enough. I can run the pico at 378MHz, and then you get to 0.6ms. Not fast enough (only the 2 CRC's are 1.2ms).

To get it faster... (or find an alternative solution) I would need a CSUB or MATH CRC.
Maybe it is time to learn CSUB making... Maybe I am being lazy, or hesitant to take the CSUB training, and looked to Peter to do the work for me. I appologize for the question raised. Sorry Peter.

Regards,

Volhout
PicomiteVGA PETSCII ROBOTS
 
twofingers
Guru

Joined: 02/06/2014
Location: Germany
Posts: 1245
Posted: 01:36pm 20 Dec 2022
Copy link to clipboard 
Print this post

  Volhout said  ... Maybe I am being lazy, or hesitant to take the CSUB training, ...

I think CSubs are much easier than many think.
Especially when you can easily convert it from Arduino code.

Maybe Geoff should add a short CSub guide as a PDF to the firmware? ... and some examples too? (as for the Micromite)

Regards
Michael

BTW. @Harm
I like your excellent PIO thread but I don't think it's a good idea to jump in there just to say thank you.
Edited 2022-12-21 01:15 by twofingers
causality ≠ correlation ≠ coincidence
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4253
Posted: 03:24pm 20 Dec 2022
Copy link to clipboard 
Print this post

  matherp said  
Can't comment accurately on the overhead of large number of files on space used. but I know each file uses c 1K for a header so every 4 files or so will eat another 4K block


OK, you are using 4k blocks. That completely explains it...

6006bytes eat up 2 of the 4k blocks = 2x4096 = 8192bytes
85 files = 85x8192 = 696320 bytes = 700k.
Total flash filesystem was 700k bytes ... so it is full.!!!

Volhout
PicomiteVGA PETSCII ROBOTS
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9137
Posted: 03:29pm 20 Dec 2022
Copy link to clipboard 
Print this post

See new thread for CRC support

Please use new thread  for any further posts on 5.07.06
Edited 2022-12-21 01:31 by matherp
 
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 2079
Posted: 04:17pm 20 Dec 2022
Copy link to clipboard 
Print this post

  Tinine said  have you tried the captain's look-up table method on FoTS?

  Volhout said  I have looked at Captains lookup table method.


correction: Turbo46's method
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1611
Posted: 05:17am 30 Apr 2023
Copy link to clipboard 
Print this post

Sorry for resurrecting and old thread but this is where the MATH CRC thing started. The manual says:
  Quote  MATH(CRCn data [,length] [,polynome] [,startmask] [,endmask] [,reverseIn] [,reverseOut]
Calculates the CRC to n bits (8, 12, 16, 32) of “data”. “data” can be an integer or floating point array or a string variable. “Length” is optional and if not specified the size of the array or string length is used. The defaults for startmask, endmask reverseIn, and reversOut are all zero. reverseIn, and reversOut are both Booleans. The defaults for polynomes are CRC8=&H07, CRC12=&H80D, CRC16=&H1021, crc32=&H04C11DB7
e.g. for crc16_CCITT use MATH(CRC16 array(), n,, &HFFFF)

It doesn't attempt to explain the use and meaning of all of the arguments like startmask, endmask, reverseIn and reversOut.

I have looked at the references Volhout provided but I'm really none the wiser. Can someone please explain in simple terms what they are used for and how they would affect the calculation and presentation of the CRC value?

Setting the reverseOut argument to either 0 or 1 does not change the result of a MODBUS CRC calculation?

Bill
Keep safe. Live long and prosper.
 
panky

Guru

Joined: 02/10/2012
Location: Australia
Posts: 1101
Posted: 05:21am 30 Apr 2023
Copy link to clipboard 
Print this post

Bill,

This link crc explained gives a pretty useful explanation of crc and may help decoding the MMBasic implimentation.
Regards,
Doug.

PS. I intend putting a link into the MMB4W manual about this.
... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it!
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1611
Posted: 05:32am 30 Apr 2023
Copy link to clipboard 
Print this post

Thanks Doug, I've been there but it doesn't explain the use of those parameters - not to me anyway. I put the CRC entries on the Fruit of the Shed (TassyJim wrote the first one) so I've been playing with CRCs for a while. Those unexplained parameters are there to make the routines more flexible (I believe) but I would just like their use and affects explained.

Bill
Keep safe. Live long and prosper.
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6101
Posted: 05:42am 30 Apr 2023
Copy link to clipboard 
Print this post

The wikipedia entry is another reference
https://en.wikipedia.org/wiki/Cyclic_redundancy_check
IT has a long list of known CRC values

I think 'reverse' refers to bits being shuffled in LSB first.
ONEWIRE does that so I used 1 for reverseIn and reverseOut and I started getting the correct results.

Jim
VK7JH
MMedit   MMBasic Help
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1611
Posted: 05:54am 30 Apr 2023
Copy link to clipboard 
Print this post

Thanks Jim, I've been there too. I expected that reverseIn and reverseOut reversed the bit order of calculating the CRC and the bit order of presenting the CRC value respectively but as I said earlier: setting the reverseOut argument to either 0 or 1 does not change the result of a MODBUS CRC calculation. So I am unsure about that and that makes me unsure about the effect of using reversIn too.

Bill
Keep safe. Live long and prosper.
 
     Page 5 of 5    
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024