LowPowerLab Forum

Hardware support => Moteino => Topic started by: JohnO on August 17, 2014, 10:35:51 AM

Title: MEGA using interrupts - INT2 [SOLVED]
Post by: JohnO on August 17, 2014, 10:35:51 AM
I am trialling the Jeelabs RF12Demo software on my recently delivered Moteino MEGA. I have made the adjustments I expected but am having a problem around interrupts. The interrupt is firing correctly on packet reception but things go wrong on transmission. The first packet is offered for transmission and the interrupt indicating successful transmission fires but then the interrupt mechanism is stalled with reception and transmission no longer possible. Is there anything unusual about INT2 on PB2 that I should be considering?

I have tried two different RFM69W cards with identical results.
Title: Re: MEGA using interrupts - INT2
Post by: Felix on August 18, 2014, 08:37:06 AM
Does RF12Demo support RFM69 radios?
What speed is the SPI in the jeelib? If it's 8mhz its too fast, slow it down to 4mhz.
Title: Re: MEGA using interrupts - INT2
Post by: JohnO on August 18, 2014, 11:11:07 AM
Thanks Felix, the RF12DEMO branch supports RFM69 radios. The issues I am seeing appear SPI related, I have just turned off SPI2X maybe a need to slow down more.
Title: Re: MEGA using interrupts - INT2
Post by: Felix on August 18, 2014, 11:40:59 AM
I have a hard time keeping up with what everyone else is doing but I guess everyone started to take a serious look at RFM69 and RFM12B is slowly going away.
For the atmega1284p it looks like it needs a slower clock than the mega328p. 4mhz should be good enough.
Title: Re: MEGA using interrupts - INT2
Post by: JohnO on August 18, 2014, 12:29:29 PM
The RFM12B is fine for some jobs and I will still be using them. I have dropped down to 1M SPI and still seeing my problem - perhaps it something else. Works fine at full speed on a 328P.
Title: Re: MEGA using interrupts - INT2
Post by: Felix on August 18, 2014, 01:24:57 PM
Is my latest RFM69 library working?
Title: Re: MEGA using interrupts - INT2
Post by: JohnO on August 18, 2014, 02:54:12 PM
I'm afraid I haven't tried it - would it be able to receive from my Jeelib nodes?
Title: Re: MEGA using interrupts - INT2
Post by: Felix on August 18, 2014, 04:27:25 PM
I don't know since I don't support jeelib.
All I can say is the MoteinoMEGA works with the RFM69 lib (latest) and if there are issues with that then this is the place to bring it up. This forum is meant to support LowPowerLab hardware/libraries only.
Title: Re: MEGA using interrupts - INT2
Post by: JohnO on August 19, 2014, 08:09:39 AM
I have some of your example sketches running now built with your libraries under 1.0.5r2. The gateway & node sketches both work fine on 328P, I have gateway on Jee hardware with RFM69CW hardware and node on a Moteino 328 with RFM69W radio. When I load node onto the MEGA with RFM69W hardware I see:

Transmitting at 868 Mhz...
SPI Flash Init FAIL! (is chip present?)

with nothing on the gateway node.

I may be missing something on the MEGA build as I only changed the board type to do its compile/upload.
Title: Re: MEGA using interrupts - INT2
Post by: Felix on August 19, 2014, 08:11:40 AM
Do you have a FLASH chip on your MoteinoMEGA?
Title: Re: MEGA using interrupts - INT2
Post by: JohnO on August 19, 2014, 09:39:03 AM
No, I don't have flash on my other Moteino 328. It appears to ignore the flash being absent on the 328.
Title: Re: MEGA using interrupts - INT2
Post by: JohnO on August 19, 2014, 09:40:24 AM
I did try the Jeelabs sketch that fails on the MEGA and it works fine on the Moteino 328.
Title: Re: MEGA using interrupts - INT2
Post by: JohnO on August 19, 2014, 10:01:43 AM
I have reversed the roles and now have the MEGA as my gateway node and a 328 as a node.
The MEGA appears to receive and ACK a couple of packets and then goes quiet for a while before receiving another packet or two:


[19/08/14 - 15:03:49:104] Listening at 868 Mhz...
[19/08/14 - 15:03:49:108] SPI Flash Init FAIL! (is chip present?)
[19/08/14 - 15:03:49:108] [3] to [1] 12   [RX_RSSI:-27] - ACK sent. Pinging node                                     [19/08/14 - 15:03:57:915]  3 - ACK...nothing
[19/08/14 - 15:03:59:579] [3] to [1] 123 ABCDEFGHIJ   [RX_RSSI:-38] - ACK sent.
[19/08/14 - 15:04:00:589] [3] to [1] @123 ABCDEFGHIJKL   [RX_RSSI:-128]
[19/08/14 - 15:04:00:635] [3] to [1] 123 ABCDEFGHIJKLM   [RX_RSSI:-38] - ACK sent.
[19/08/14 - 15:04:10:932] [3] to [1] @FLASH_MEM_ID:0x202   [RX_RSSI:-128] - ACK sent. Pinging node 3 - ACK...nothing
[19/08/14 - 15:04:10:965] [3] to [1] 123 ABCDEFGHIJKLMNO   [RX_RSSI:-39] - ACK sent.
[19/08/14 - 15:04:32:093] [3] to [1] 123 ABCDEFGHIJKLMNOPQRSTUVW   [RX_RSSI:-39] - ACK sent.
[19/08/14 - 15:05:07:046] [1] to [1] @123 ABCDEFGHIJKLMNO   [RX_RSSI:-128]
[19/08/14 - 15:05:29:618] [3] to [1] 123 ABCDEFGHIJKLMNOP   [RX_RSSI:-42] - ACK sent. Pinging node 3 - ACK...nothing
[19/08/14 - 15:05:29:721] [3] to [1] 123 ABCDEFGHIJKLMN   [RX_RSSI:-39] - ACK sent.
[19/08/14 - 15:05:45:744] [1] to [8] @123    [RX_RSSI:-128]
[19/08/14 - 15:05:45:792] [3] to [1] 123 A   [RX_RSSI:-39] - ACK sent.
[19/08/14 - 15:06:06:426] [3] to [1] 123 ABCDEFGHIJKL   [RX_RSSI:-128] - ACK sent. Pinging node 3 - ACK...nothing
[19/08/14 - 15:06:45:997] [3] to [1] 1123 ABCDE   [RX_RSSI:-128] - ACK sent.
[19/08/14 - 15:07:22:990] [3] to [1] @123 ABCDEFGHIJKLMNO   [RX_RSSI:-128]
[19/08/14 - 15:07:23:850] [3] to [1] 123 ABCDEFGHIJKLMNOPQ   [RX_RSSI:-48] - ACK sent.
[19/08/14 - 15:07:59:877] [3] to [1] 123 ABCDEFGHIJKLMNOPQ   [RX_RSSI:-40] - ACK sent. Pinging node 3 - ACK...nothing




I have the 328 node sending packets every 900ms. The node never appears to receive the ACK.
Title: Re: MEGA using interrupts - INT2
Post by: Felix on August 19, 2014, 10:26:26 AM
The "Flash init FAIL" means there is no FLASH on board, which corresponds to reality.
Have you updated the RFM69 library?
Title: Re: MEGA using interrupts - INT2
Post by: JohnO on August 19, 2014, 10:32:39 AM
I have the latest version from git: Add Mighty Boost control sketch being the latest update.

I have also just reflowed the soldered radio connections.
Title: Re: MEGA using interrupts - INT2
Post by: JohnO on August 19, 2014, 10:43:10 AM
USB derived VIN=5v05 3v3=3v31
Title: Re: MEGA using interrupts - INT2
Post by: Felix on August 19, 2014, 12:04:31 PM
Make sure you don't have any trace of the old library in the Arduino/libraries folder.
All moteinos are tested with the Node sketch against a tester loaded with the Gateway sketch. They all have to pass sending and receiving before being shipped.
I cannot guarantee any Moteinos where the end user solders the radio themselves. Those are only loaded with a blinky sketch to ensure programmability and basic functionality.
Title: Re: MEGA using interrupts - INT2
Post by: JohnO on August 19, 2014, 12:08:26 PM
Do you ship many devices without flash ? I wonder if there is some noise pick-up from the unused tracks
Title: Re: MEGA using interrupts - INT2
Post by: JohnO on August 19, 2014, 12:12:38 PM
Quote from: Felix on August 19, 2014, 12:04:31 PM
I cannot guarantee any Moteinos where the end user solders the radio themselves. Those are only loaded with a blinky sketch to ensure programmability and basic functionality.

I would have ordered with radio but you don't fit the genuine 868MHz. I don't like the idea of using 915MHz modules - if I then had strange things happening someone would claim the radio was incompatible.

On the soldering front I have built many Jeenodes from scratch without any failures although I understand your concern.
Title: Re: MEGA using interrupts - INT2
Post by: Felix on August 19, 2014, 01:00:07 PM
The external FLASH chips are optional and the cost extra, so they don't come by default.
The reason I can't give a guarantee is because if I'm not the source of all the components, that makes no sense. People can always save a buck by doing a little work themselves but then they have to take the responsibility to cover for any potential issues.
I have never seen any problems caused by noise or capacitive coupling on the SPI or other traces.
The traces themselves are at least 10-12mil so pretty thick, even thicker on the regular Moteino.
The differences between 868 and 915mhz passives in the filters are minimal and I have not seen significant difference in performance tests. That's why I chose to only carry 915 versions which can be used at 868 without a noticeable difference. You could do much more on the bitrate/bandwidth settings to dramatically affect performance and range. Also I'm sure the makers know the negligible differences between the two bands and I wouldn't bet all I have on the fact that the two modules are in fact identical in BOM, just marked differently. Just as much as I wouldn't bet the chips are not in fact fake silicon that happens to just work. Never bet on china ;)
Title: Re: MEGA using interrupts - INT2
Post by: JohnO on August 19, 2014, 01:07:59 PM
Could you try your MEGA, without flash with your gateway sketch and let me know if it works correctly?

My radios came from the authorised UK distributor but ultimately from China. A radio from the same batch is working fine on my Moteino 328.
Title: Re: MEGA using interrupts - INT2
Post by: Felix on August 19, 2014, 02:39:08 PM
It works.
Title: Re: MEGA using interrupts - INT2
Post by: JohnO on August 19, 2014, 02:50:43 PM
I bought a batch of ten RFM69W devices from the UK Distributor the first one was fitted to my first Moteino 328 and it works fine with both your gateway code and the Jeelabs software proving such a challenge for the MEGA. The third & fourth radios from my batch have been tried on the MEGA and both show the same problem.

I will try to scope the SPI lines tomorrow and see if anything pops up.

Ah, and before you ask the second radio lives on a breadboard and works fine too.
Title: Re: MEGA using interrupts - INT2
Post by: Felix on August 19, 2014, 05:38:00 PM
Again, SPI needs to be at 4Mhz to work. Don't expect it to run on the jeelib out of box. I can only say it should work with the LowPowerLab RFM69 Library (http://github.com/lowpowerlab/rfm69).
Title: Re: MEGA using interrupts - INT2
Post by: JohnO on August 20, 2014, 04:37:59 AM
You were right to challenge my soldering I had a high resistance on the GND connection to the radio. The Jeelabs library is happy with SPIX2, 8 meg SPI. They don't use the SPI library so maybe that is it.

Do you have a CRC check over the radio payload in your library?
Title: Re: MEGA using interrupts - INT2 [SOLVED]
Post by: Felix on August 20, 2014, 08:09:41 AM
CRC is a hardware feature in the RFM69 which is better/faster than the firmware implementation for the RFM12b.
Title: Re: MEGA using interrupts - INT2 [SOLVED]
Post by: JohnO on August 20, 2014, 08:27:19 AM
Good, that explains why the payload was corrupted by my soldering problem. I couldn't understand why the library was accepting the invalid payload - the payload was good into the radio but bad into the 1284P.