Author Topic: Define MMSByte for AS3935 Lightning Detector (SOLVED)  (Read 4273 times)

0 Members and 1 Guest are viewing this topic.

Offline jpanhaltTopic starter

  • Super Contributor
  • ***
  • Posts: 3476
  • Country: us
Define MMSByte for AS3935 Lightning Detector (SOLVED)
« on: July 12, 2017, 07:17:49 pm »
(SOLVED)
Answer from AMS: “The energy value is a 20 bit value which is divided into a LSB (lowest 8bit in Reg 0x04), and MSB (medium 8 bit in Reg 0x05) and a MMSB (upper 4 bit value, lower nibble in Reg 0x06). MMSB is not between LSB and MSB”.


The AMS AS3935 lightning detector calculates a unitless value for the energy of the discharge.  It is a 21-bit value stored in three registers:
LSByte = 0x04
MSByte = 0x05
MMSByte = 0x06, bits<4:0>

In my experience, MMSB means "middle" MSB, i.e., a byte between the MSB and LSB (likewise for MLSB).  When both MMSB and MLSB are present, the byte order seems obvious.  Moreover, if one looks at the 14-bit encoders from AMS and other vendors, the upper byte is the smaller.

In this instance, I can deal with the "middle" byte being only 5 bits, but it would be easier if the 5-bit byte were the highest byte. 

Duplication of an adverb is commonly (and unfortunately) used for emphasis, like "being very,very sure."  By analogy, could it mean "most, most" or "maximum, most" or other silly things?

Is anyone "really,really sure" of the meaning of MMSB for this device?  ;D

Yes, I can test it and read the registers to find out, but asking here is easier.

Regards, John 
« Last Edit: July 14, 2017, 10:49:46 am by jpanhalt »
 

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3240
  • Country: gb
Re: Define MMSByte for AS3935 Lightning Detector
« Reply #1 on: July 13, 2017, 09:54:36 am »
I don't know what MMSB stands for, but it would make no sens to break the value up so there were less than 8 bits in the middle byte so I would expect "MMSB" to hold the most significant bits.

The datasheet should explain this more clearly but it does hint at the byte ordering in the description where the registers appear to be listed in order from MSB to LSB.

Quote from: datasheet
The result of the energy calculation is then stored in the registers REG0x06[4:0], REG0x05[7:0] and REG0x04[7:0]"

 

Offline jpanhaltTopic starter

  • Super Contributor
  • ***
  • Posts: 3476
  • Country: us
Re: Define MMSByte for AS3935 Lightning Detector
« Reply #2 on: July 13, 2017, 10:15:21 am »
Here's the AS3935 datasheet: http://media.digikey.com/pdf/Data%20Sheets/Austriamicrosystems%20PDFs/AS3935.pdf

I could not find an explicit answer there.  It didn't make sense to me either, but there are ample examples to support that MMSB is typically if not always the middle byte.

Anyway, I should have an answer in the next couple of days.

John

 

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3240
  • Country: gb
Re: Define MMSByte for AS3935 Lightning Detector
« Reply #3 on: July 13, 2017, 04:04:20 pm »
As I said the datasheet text suggests that MMSB holds the high order bits, even if it's not explicit, and this is the most logical interpretation. 

These two bits of code also use MMSB register as the high order word.

https://github.com/pcfens/RaspberryPi-AS3935/blob/master/RPi_AS3935/RPi_AS3935.py
https://github.com/SkyeSweeney/Striker/blob/master/AS3935.ino
 

Offline jpanhaltTopic starter

  • Super Contributor
  • ***
  • Posts: 3476
  • Country: us
Re: Define MMSByte for AS3935 Lightning Detector
« Reply #4 on: July 13, 2017, 04:56:16 pm »
Thanks for doing that research.

I do not disagree that the usual way multiprecision registers are listed is in order*, and if one register is not 8-bits, that is the topmost register.  Nevertheless, I could not find a single example of "MMSB" being used to mean the topmost register and MSB being used to mean a middle register. 

As for the examples and the instances in the datasheet, they are symmetrical in context, meaning at every instance registers "0x05" and "0x06 (bits 4:0)" could be interchanged, and the grammar would not be corrupted.  Couldn't find an errata for the chip either.

When I get time (maybe today), I will read the three registers as I stimulate the chip with my simulator.  Should be able to tell which registers fill first.

John

*Definitely makes it easier to use indirect addressing to fill and read


 

Offline jpanhaltTopic starter

  • Super Contributor
  • ***
  • Posts: 3476
  • Country: us
Re: Define MMSByte for AS3935 Lightning Detector (SOLVED)
« Reply #5 on: July 14, 2017, 10:52:27 am »
Answer from AMS: “The energy value is a 20 bit value which is divided into a LSB (lowest 8bit in Reg 0x04), and MSB (medium 8 bit in Reg 0x05) and a MMSB (upper 4 bit value, lower nibble in Reg 0x06). MMSB is not between LSB and MSB”.


A new definition for "MSB".   It also seems the engineers at AMS consider bits (4:0) as the lower "nibble."   And all this time, I though a Nibble was only 4 bits, not five.
 

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3240
  • Country: gb
Re: Define MMSByte for AS3935 Lightning Detector (SOLVED)
« Reply #6 on: July 16, 2017, 10:03:19 am »
It is a very poor way of of describing the registers, whoever decided to use MSB and MMSB needs the application of a swiftly moving boot to their rear end.

Far better to describe it like this:

Reg 0x04: Energy word, bits 0:7
Reg 0x05: Energy word, bits 8:15
Reg 0x06: Energy word, bits 16:20
 

Offline jpanhaltTopic starter

  • Super Contributor
  • ***
  • Posts: 3476
  • Country: us
Re: Define MMSByte for AS3935 Lightning Detector (SOLVED)
« Reply #7 on: July 16, 2017, 10:33:20 am »
True, but now we don't know whether it is a 20-bit word or 21-bit word.

Probably just an example where the simplest response was avoided and the more unusual explanation simply adds confusion. 

 

Offline amyk

  • Super Contributor
  • ***
  • Posts: 8270
Re: Define MMSByte for AS3935 Lightning Detector (SOLVED)
« Reply #8 on: July 16, 2017, 03:13:24 pm »
The datasheet consistently refers to 21 bits.

Looking at the company name, they might not be great at English either.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf