Simple compact RS485 node v2 (ATmega328 + MAX3485 + W25X40)
License:
Attribution-ShareAlike (CC-BY-SA)
Created:
4 years ago
Updated:
4 years ago
Views:
5014
2 Collect
2 Comments
Share
59 Download (3.55 MB)
Donate to support Open Hardware

This is version 2 of a Simple compact RS485 node with support FOTA

You can order PCB from PCBs.io - 4pcs for $4.65, black 1.6mm PCB

D7 pin used for control RS485 DE/RE input.
A2 pin used as CS pin of flash Winbond W25X40.

On long side of board present 11-pin header include:

  • D2, D3, D4, D5
  • A0, A1, A4/SDA, A5/SCL
  • GND, 5V

On short side of board present two pin header include:

  • 5V, GND, D2, D3 (for simple connect sensors like DS18B20, DHT22)
  • RES, TX, RX (for connect UART)

On bottom side of board present MISO, MOSI, and SCK for programming bootloader to ATmega328.

Present place to solder crystal oscillator, if you need stability of UART working on high speed.

Present place to solder pull-up resistors for RES, D2, D3, SDA, SCL signals.
It is also possible to install LED connected between D6 pin and 5V through 510Ohm resistor.

!!! Attention !!!
You must use 3.3V to power the node because of not need locic level shifting when connect flash W25X40
(i used MAX3485 and LDO LP2950ACZ-30 to power from 12V)

For FOTA used custom DualOptiBoot with A2 pin for CS of flash builded from source for ATmega328P, 8Mhz, 38400 UART speed for upload).

Fuse setting for DualOptiboot:

  • high_fuses=0xDA
  • low_fuses=0xE2
  • extended_fuses=0x06

For test you can use TestNode_RS485_OTA

!!! Attention !!!
For correct work of FOTA with flash chip Winbond W25X40CLSNIG you need to use patched lib SPIFlash.h

Here is the correction of code:

#ifndef SPIFLASH_BLOCKERASE_32K
//#define SPIFLASH_BLOCKERASE_32K   0x52        //!< erase one 32K block of flash memory
#define SPIFLASH_BLOCKERASE_32K   0xD8        // need same as 64K
#endif

#ifndef SPIFLASH_BLOCKERASE_64K
#define SPIFLASH_BLOCKERASE_64K   0xD8        //!< erase one 64K block of flash memory
#endif

Place to solder crystal oscillator:

Place to solder crystal oscillator