Define MMSByte for AS3935 Lightning Detector (SOLVED) - Page 1
Forum section: electronics / general

author: jpanhalt
author_rank: Super Contributor
timestamp: July 12, 2017, 07:17:49 pm
content: (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 = 0x04MSByte = 0x05MMSByte = 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?Yes, I can test it and read the registers to find out, but asking here is easier.Regards, John

author: mikerj
author_rank: Super Contributor
timestamp: July 13, 2017, 09:54:36 am
content: 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

author: jpanhalt
author_rank: Super Contributor
timestamp: July 13, 2017, 10:15:21 am
content: Here's the AS3935 datasheet:http://media.digikey.com/pdf/Data%20Sheets/Austriamicrosystems%20PDFs/AS3935.pdfI 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

author: mikerj
author_rank: Super Contributor
timestamp: July 13, 2017, 04:04:20 pm
content: 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.pyhttps://github.com/SkyeSweeney/Striker/blob/master/AS3935.ino

author: jpanhalt
author_rank: Super Contributor
timestamp: July 13, 2017, 04:56:16 pm
content: 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

author: jpanhalt
author_rank: Super Contributor
timestamp: July 14, 2017, 10:52:27 am
content: 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.

author: mikerj
author_rank: Super Contributor
timestamp: July 16, 2017, 10:03:19 am
content: 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:7Reg 0x05: Energy word, bits 8:15Reg 0x06: Energy word, bits 16:20

author: jpanhalt
author_rank: Super Contributor
timestamp: July 16, 2017, 10:33:20 am
content: 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.

author: amyk
author_rank: Super Contributor
timestamp: July 16, 2017, 03:13:24 pm
content: The datasheet consistently refers to 21 bits.Looking at the company name, they might not be great at English either.