cbalint13 / tinnymodbus

RS485 ModBus tiny multi-sensor module
Other
99 stars 31 forks source link

Digispark ATTINY85 Mini USB #17

Closed saorxxx1 closed 1 year ago

saorxxx1 commented 1 year ago

Hello Balint Cristian,

First of all, congratulations for this work. Nice work. Thank you for your effort.

My problem is how do I load this work on an ATTINY85 module. There is a USBasp programming kit, I tried it on linux. The error message related to the make command is "overlap boot begin". I guess I didn't succeed. Are there any installation instructions on this?

Thank you for your interest and I wish you good work. Kind regards.

DrRob commented 1 year ago

I think this "overlap" issue happens if you don't use the recommended version of the toolchain - the code is a very tight fit and others versions of the toolchain produce an image that is too large to fit, causing it to overlap the area reserved for the bootloader.

saorxxx1 commented 1 year ago

Araç zincirinin önerilen sürümünü kullanmazsanız bu "örtüşme" sorununun ortaya çıktığını düşünüyorum - kod çok sıkı bir şekilde oturuyor ve araç zincirinin diğer sürümleri sığamayacak kadar büyük bir görüntü üretiyor ve bu da alanın üst üste gelmesine neden oluyor önyükleyici için ayrılmıştır.

Hello DrRob,

First of all, thank you for your interest and response. It's clear that I really need some help with this. I don't understand exactly what you mean, but there seems to be an incompatibility as you say. I loaded the existing boot.hex and boot.eep files with USBasp. But I could not solve this problem with the make command and the burn command.

DrRob commented 1 year ago

Hi Saorxxx1,

Have a look at this closed issue - I think it's the same problem: https://github.com/cbalint13/tinnymodbus/issues/10

cbalint13 commented 1 year ago

Hi @saorxxx1,

If not sure how to obtain exact 8.0.1 you can use ready compiled .hex provided here.

no-ahnu commented 8 months ago

Hello, i use the Google translator. Unfortunately I fail when trying to run make.sh. I also get the "error" overlap. Unfortunately I can't get gcc version 8.0.1 installed either. With versions 7.4, 8.4 or 9 I get the error message.

What else can I do? or can someone send me the boot.hex and main.hex?

THANK YOU and greetings

cbalint13 commented 8 months ago

Hello, i use the Google translator. Unfortunately I fail when trying to run make.sh. I also get the "error" overlap. Unfortunately I can't get gcc version 8.0.1 installed either. With versions 7.4, 8.4 or 9 I get the error message.

What else can I do? or can someone send me the boot.hex and main.hex?

THANK YOU and greetings

Hi @no-ahnu ,

You can follow these steps for a very easy dockerized deployment: https://github.com/cbalint13/tinnymodbus/tree/master/tools/docker

Now,

I've also updated the main page to point to these build steps.

Greetings, ~Cristian.

no-ahnu commented 8 months ago

THANKS Cristian for the quick response and help!

I was able to create the file using Docker :). Unfortunately I cannot fully execute the remote flash. It lingers

3 or 25 TX: RV: Lines stand. Do you also have a tip here? Or can the main.hex also be flashed via the programmer?

EDIT: I found another "error" in burn.sh. In line:

avrdude -c stk500v2 -P /dev/ttyACM0 -p attiny85 $FUSE_FLAGS-U flash:w:boot.hex -U eeprom:w:boot.eep -B3

The space character is missing after "$FUSE_FLAGS", for the -U parameter

avrdude -c stk500v2 -P /dev/ttyACM0 -p attiny85 $FUSE_FLAGS -U flash:w:boot.hex -U eeprom:w:boot.eep -B3

I get an error message with pymodbus3.x/bootmode-info.py:

user@deb:~/tinnymodbus-master/tools/examples/pymodbus3.x$ sudo python3 bootmode-info.py 1 modbus cmd: 0x03 value: 0x0000 length: 0x01

08:32:46 DEBUG transaction:130 Current transaction state - IDLE 08:32:46 DEBUG transaction:134 Running transaction 1 08:32:46 DEBUG transaction:291 SEND: 0x1 0x3 0x0 0x0 0x0 0x1 0x84 0xa 08:32:46 DEBUG base:199 New Transaction state "SENDING" 08:32:46 DEBUG transaction:312 Changing transaction state from "SENDING" to "WAITING FOR REPLY" 08:32:46 DEBUG transaction:428 Changing transaction state from "WAITING FOR REPLY" to "PROCESSING REPLY" 08:32:46 DEBUG transaction:327 RECV: 0x81 0x83 0x20 0x1 0x79 08:32:46 DEBUG rtu_framer:247 Frame check failed, ignoring!! 08:32:46 DEBUG rtu_framer:132 Resetting frame - Current Frame in buffer - 0x81 0x83 0x20 0x1 0x79 08:32:46 DEBUG transaction:528 Getting transaction 1 08:32:46 DEBUG transaction:234 Changing transaction state from "PROCESSING REPLY" to "TRANSACTION_COMPLETE" Traceback (most recent call last): File "/home/user/tinnymodbus-master/tools/examples/pymodbus3.x/bootmode-info.py", line 82, in decoder = BinaryPayloadDecoder.fromRegisters(result.registers, byteorder=Endian.Big, wordorder=Endian.Big) ^^^^^^^^^^^^^^^^ AttributeError: 'ModbusIOException' object has no attribute 'registers' user@deb:~/tinnymodbus-master/tools/examples/pymodbus3.x$

Which USB <-> Modbus stick do you recommend?

no-ahnu commented 8 months ago

I solved the problem with a new Modbus <-> USB converter with CH343 chip

cbalint13 commented 8 months ago

I solved the problem with a new Modbus <-> USB converter with CH343 chip

To fully answer, I used many kind of usb <-> rs485 or rs232 <-> rs485, from cheapest max487 like the one here to expensive galvanic isolated solutions (ADUM series) and never had problems. As a practice when in doubt is easy to double check things with a scope (if have one at hand) since these are realy slow / lazy signals.