[Logo] Anarduino and HopeRF Community Forum
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics     [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Messages posted by: stevech
Forum Index » Profile for stevech » Messages posted by stevech
Author Message
Yes, it's a struggle.

I have the a bootloader working on the mega328 and mega1284 with the Spansion SPI Flash chip. And other code I wrote writes to the flash the downloaded new firmware that was sent via RadioHead's stack on a gateway that connects via a RadioHead stack to a PC's serial port. Then that serial port link (datagram) goes on into a Python-coded version of RadioHead's stack, then into the applications which are GUI based Python. These apps manage all the radios and their configs and distribution of new firmware when needed. The end nodes send unsolicited status messages now and then and that includes what firmware version is in use - so the apps can know which ones need updates.
the entry to sleep doesn't command the radio to sleep, right? Its power stays on?
So the sleep mode is just the AVR microprocessor.

If these are true, then you might read the AVR specs and see if the SPI port needs to be reinitialized on wakeup
w1ll14m wrote:Hi Steve,

I have started playing around with the optiboot code. I have issues reading the SPI flash, I was hoping you could tell me how you read the SPI flash from within the bootloader?

I have SPI code in the bootloader that does not use a library. It's small and tight.

I may soon have an agreement with Anarduino on this bootloader and possibly too, the more complex higher level protocols to send the firmware to network nodes using the RadioHead stack for the radio-hardware transparency under my application protocols and file transfer code. I still don't know how to prevent intellectual property theft when I choose not to make this open source. License agreements are not honored by most on our planet.

did you keep your receipt to show the part number ordered?

I've not used the radios of which you inquire, but the following applies to most all of HopeRF's modules/boards.

There are band-specific RF filter components (434,868,915) MHz bands on the board. The boards are marked as to which band these components are tuned. When soldered on to a board, this marking may be obscured, so you have to have otherwise marked them yourself, or you have purchasing documents/receipts that show which band you ordered.

The radios are tuned by software command; they're not tuned by internally fixed constants (e.g., firmware configuration).
If your software tunes a 915Mhz product to 868MHz, the penalty will be small, about 10%, so I've read.
Tuning this to 434MHz, or 315MHz, has a prohibitive degradation in transmitter power and receiver sensitivity - e.g., 20dB.
Vice-versa, tuning a 434MHz radio to 915Mhz.

In North America, the "915" MHz band refers to the ISM band spanning 902-928MHz, with 915Mhz being a default.

that's what I know.

Rick may have other insights.

SadE wrote:Moreover I saw the 328P is not stated to work with 3.3V at 16Mhz.
It could work , maybe in 90% of cases, or could work at 25°C and not a 0° ...
An answer from the designer is widely expected !

328P does work for 16MHz at 3.3v but I've never tried it at the extremes of temperature specs. It may not work at 20MHz at 3.3 rather than 5V.
athtest800 wrote:Hello!
I use the RFM69HW Mini wireless.
I added an ST7735 LCD by using either the UTFT either the adafruit ST7735 library https://github.com/adafruit/Adafruit-ST7735-Library.
The result is 3-5 white(?) pixels that are shown on LCD. This is very ugly.
The problem appears with this function
with the LowPowerLabs https://github.com/LowPowerLab/RFM69 and
with the RadioHead http://www.airspayce.com/mikem/arduino/RadioHead/.

What can i do to solve it?
Thank you.
The RadioHead driver, and probably also LowPowerLab's driver (independent software suites), the interrupt service routine (ISR) for the radio uses the SPI port. The ISR makes the assumption that it can use the SPI port at any time. When your LCD is using the SPI port, it can get interrupted by the radio's ISR and now we have a mess. The radio's ISR runs at the end of a transmitted or received packet.

The LCD software can disable interrupts while using the SPI port - that's brute force.
The LCD software can set the external interrupt mask bit for the radio's IRQ bit, while the LCD is using the SPI.
The LCD software can force the radio into its idle state (not receiving or transmitting cannot interrupt) - use the SPI port, then reenable the radio with a call to available()

ALso, there's an issue if the LCD and the radio want the SPI to be in different configurations, such as SPI clock frequency. Each device might initialize SPI at startup but do so differently.

This overall issue of SPI port-sharing, in the Arduino community, is known issue that arises because people develop drivers without think of SPI port sharing.

Paul at PJRC.com (teensy 3) has a library to manage SPI port sharing. But SPI-based devices have to use that library instead of the generic SPI library. The new library "SPI Transactions" is availble but slow to be adopted. It brings problems, too, such as: If some SPI-based device uses SPI Transactions to "own the SPI port" for a while, real-time devices like the data radios can on occasion miss an incoming message - if the port is "Hogged" too long. This happens at low SPI clock frequencies and/or large SPI transfer loops such as in an SD card.

So the 3 hacks, above, are all I can suggest.
This presumes that you do have a conflict with the radio's ISR as described above. If the LCD driver is already disabling interrupts while using the SPI, every time, everywhere, then there could be an issue with the two devices wanting the SPI bit rate or byte format to differ, and they don't reestablish the SPI port prior to each use. RadioHead only configures once.
jrbenito wrote:
stevech wrote:I don't now know of a way to control non-commercial use of such code - as there are commercial uses now.

suggestions welcomed.

By control you mean avoid the use or forbid it?


Control the use of code for commercial purposes - because in much of the world today, licensing agreements are ignored.
I don't now know of a way to control non-commercial use of such code - as there are commercial uses now.

suggestions welcomed.

the latests major addition is
Use the GUI on the PC to "ping all" in-range nodes.
They all reply in a time-orderly manner (rather than just mash-up collisions)
Now we have a list of radio/MCU nodes out there, the RSSI of each, the code version of each, etc.

Then you can click once to send new code to them all (assuming that's the right thing to do). Each has saved it's unique config in EEPROM.
The PC/Mac/Linux Python program then pushes the new code to each node in succession, with extensive error checking. Each node saves the downloaded code to SPI flash storage as in the MiniWireless boards.
The user then clicks "reboot all", and a command is sent over the air.
All reboot and the bootloader (mine) uses the SPI flash storage to rewrite AVR program memory with the new code. Then boot to run that.

Now the user on the computer clicks "ping all" and see all did come up OK and all have the correct code version.

Over the air reprogramming with automated gang programming, I guess you'd say.

I should make a demo video. But I'm such a dweeb at videos.
A mini variation with a U.FL antenna connector might be appealing due to size size, low cost.
Maybe the PCB could accommodate either. Some boards also have a hole for soldering in a loose wire, no connector.

Where needed, there are U.FL to SMA and N and others, of varying gender.
In all these SMA connectors, mind the RP (reverse polarity) options.

There would be folks who don't want U.FL, because an onboard SMA might be used in a hole in an enclosure, as is.
Perhaps the "C" means pin-Compatible with RFM12
Miniwireless boards - RFM69 radio affixed.
Any way to visually identify for which band the radio is manufactured? The marking for such is not in view.

(other than running the radio and observing signal strength with a different radio).
Charly86 wrote:Steve,

Excellent idea, I never think it could work, only one in sync response, what a nice trick and idea

By the way I received these 7 ports USB hub with switch on each port. works amazing !!!!! even better of all I tested that do some disconnect on FTDI very often, never happened with this one, so happy, thank for the tip.
I do notice on my 7 port switched hub, the USB 5V line out on each port, light load, is 4.8V, not 5V. This does affect some things... like the JTAGICE3. So you can apply an additional 5V source and it will override USB 5V.

I've been using the gang bootloader and it works fine. Even with one of ten that mistakenly had the FUSES set to clock/8, so it had the 115200 baud rate for bootloading despite the fuse mistake.
I haven't read of this done before, but enclosed is a picture of 10 mega328P AVRs.
They are wired such that one run of the downloader updates all at once.
Almost silly, but the handshake responses in the stk500-like protocol are sent by just one of the 10. The other 9 serial TX pins are not connected.
But the timing works since all run the same clock and bootloader code.
The RX and DTR pins are daisychained.

I'm using this to speed development, while I'm improving my bootloader which does over the air (OTA) wireless remote reprogramming of the mega328s. That bootloader now does one at a time OTA reprogramming but not gang programming. I'm adding gang wireless remote reprogramming - because it takes too long to do these sequentially (non-gang). The tricky part is dealing with modules that get an error on wireless.

Anyway, the wired version of the gang reprogramming is simple.


I use these mostly, due to their convenient small size, but have used other FTDI boards with no issues.

w1ll14m wrote:Hi Steve,

This sounds very amazing, I was trying to mod dualoptiboot to work with the Mini-Wireless but in the process I might have killed my 2 nodes (issues with flashing a bootloader) and waiting for my next order to arrive.
Also I would love to hear some updates about this or if there's anything I can do to help, I would love to!

It's all working with the Miniwireless boards and RadioHead reliable datagrams, and using the connection PORTs in DXRP (see above video demo).
Python program for PC/Mac/Linux/RPi with GUI works well. It initiates the over the air reprogramming and exchange of other kinds of data e.g. logs.
The code to download the new program and store it in the SPI flash chip - works - I have yet to make it a class or module or something like that so it's easy to add to a user's app.

No radio on the board? It has to be configured to sleep.

Testing high speeds with low cost HopeRF radios... FYI


I very much like the cost and size of this FTDI USB/Serial which mates with the Mini-Wireless boards and has the standard pin arrangement.


I see, in RH_ASK.cpp, the default speed is 2000 bps and the RFM85 is supported using the MCUs timers.

"Baud rate" really doesn't apply here; that applies to a UART based serial mechanism with start/stop bits, etc.
A common use of UARTs is 8N1 meaning there are a little more than 10 bit times per 8 bit byte sent.

In all these radios, FSK, ASK/OOK, the data has no start/stop bits.
ASK in RH does code data to control the number of successive 1's and 0's.

As to KHz v.s. Kbps... KHz in your context is either the receiver bandwidth configuration or the transmitter's deviation setting.

So if you use the constructor's defaults, you'll see something like 2000 bps minus overhead of preamble and coding. This is a burst rate, not a sustained rate of course. And if you use reliable datagrams, there's the overhead of ACK responses.
I was out of town last week. Back at it now!

Anarduino.com was down for a while... maintenance or delayed reboot. So Rick must be loitering around here.
In the US, unlicensed 433MHz band is supposed to have severe transmitter-on duty cycle restrictions. Due to the myriad of one-way transmissions from wireless thermometers and the like.
But I'm a licensed Ham radio guy so I can go up a few MHz to the ham band and do what I please. Run hundreds of watts if I wanted to.

902-928MHz is the unlicensed band in the US and Canada; maybe Mexico (do they have an FCC?) It too has duty cycle restrictions - less severe that 433MHz.

In both unlicensed bands, with freq. hopping you can have a higher duty cycle. These radios can hop. But perhaps most radios like this have infrequent transmissions.

868MHz in most of the EU is unlicensed but far fewer MHz than the US 900MHz band.
And somewhere in the 900MHz band are the uplink/downlink for the EU's 2G cellular (GSM), licensed.

315MHz in the US is unlicensed and widely used for garage door openers with rolling code encryption.

There's a band in the US called MURS (multi-use radio service or some such). It's around 154MHz. Limited to 5KHz FM deviation, and for data only. I wish there were HopeRF or other cheap radio modules for MURS - as is, they are pricey. That band propagates better by far than 433 and up. I wonder of other countries allow 154Mhz to be used. that's just above the 2m ham band.

Here's a new Arduino program to test/demo the MCP7940RTC real time clock chip on the Anarduino Mini-wireless boards.
The program displays the millis() counts vs. elapsed seconds from the clock chip. It also sets clock interrupt alarms for 1, 2, 4, 8... seconds and prints elapsed millis on that too.

A gotcha I've not fixed is that an alarm in 1.0 second is not yet possible. The chip won't alarm unless the alarm time is in the NEXT second or later. So the millis for the first 1 second alarm is not exact. The millis for the other alarms is off by 2-3 mSec due to overhead in the MCP7940RTC library. That library needs a re-write, I think - has too much overhead and conversions - that take lots of CPU time and memory space.

I didn't change the MCP7940 library. But as described in the code near setup(), it needs a change so that one can declare a static instance of the class as is usually done for small RAM microprocoessors. As written, one must use new() and that uses malloc() which is more code and is not friendly to a 2KB RAM micro. See the comments for recommendations. Easy change.


screen grab of output from program

the code
Forum Index » Profile for stevech » Messages posted by stevech
Go to:   
Powered by JForum 2.1.9 © JForum Team