#avr Logs

Feb 25 2020

#avr Calendar

09:58 AM sergche1991: Hello. Which bootloader would you recommend for 328P. I plan to have only uart's rx and tx pins available for users, so no hardware reset (optiboot doesnt work with a wdt triggered software). Or maybe I will try to fork optiboot and make it working with software reset (reading its sources atm).
10:05 AM Fuchikoma: Sure, but you don't always need a bootloader as such
10:05 AM cehteh: yeah, if you realy need one
10:07 AM cehteh: problem is that this needs firmware support to trigger the bootloader, so when you accidentally flash a bad firmware you need to dig it out
10:07 AM cehteh: i bet thats to be prevented
10:07 AM cehteh: thus prolly a good idea to wire the reset signal out as well, just in case
10:07 AM cehteh: (plus vcc + and gnd)
10:08 AM Fuchikoma: Well if there's no need/desire to program these in the field without a programmer, you don't need a bootloader... just program it with your firmware and let rip.
10:09 AM sergche1991: As I said device and sensors will be in the soil, half meter deep. And I cant dig there because modifiying the soil isnt allowed (we actually do agricultural research and soil can be modified only by a tractor). Thats why uart lines should be 1.5-2 meters long to not dig the soil over sensors. And I guess I need some bootloader in this case.
10:10 AM Fuchikoma: Again, you only really need a bootloader if you need to do field programming, which it sounds like it might be a good feature to have at least
10:11 AM cehteh: you need the GND out too at least
10:11 AM cehteh: how will it be powered? battery? rechargeable? ...
10:11 AM Fuchikoma: Four wires unless you implement something fancier than typical
10:12 AM Fuchikoma: But back to the original question; something like OptiBoot would be a good fit I think
10:12 AM sergche1991: Li-po battery in a separate case, so I can bring precharged ones and just change em.
10:13 AM cehteh: optiboot is trimmed to be very small... does its job but its feature is to have no features :D
10:13 AM Fuchikoma: The question as asked is yes, Optiboot is fine
10:14 AM Fuchikoma: Might need a little tweaking maybe? But otherwise fine
10:14 AM cehteh: anyway wireing reset out for 'just in case' is prolly a good idea, esp when you want to make it more reliable and digging it out is completely out of question even when you flashed the wrong firmware
10:15 AM cehteh: yeah optiboot + some tweakein (which might be already in the source configureable) will do the job
10:16 AM Fuchikoma: So the device will be buried, with a battery. I don't know that two wires is enough to program it in that state to be honest, or how you'd protect the wires
10:16 AM cehteh: just not having reset means you have to rely on the firmeware you flash to do the reset *reliably* when requested ... which may fail because of bugs
10:17 AM Fuchikoma: You could go with a 1-wire interface
10:18 AM Fuchikoma: If the power supply is rolled in already, then you'd need two wires; a ground reference and the 1-wire serial interface
10:20 AM Fuchikoma: Programming via 1-wire *and* using it for data retreival, though, is bleh.
10:26 AM Fuchikoma: Oh! You can use differential signaling, then you can implement a serial comm over that. Two wires, no need for common power/GND. With a boot loader you can send a specific command to put it into programming mode and upload new firmware
10:26 AM Fuchikoma: Bonus: Because it's differential, you can put a DC bias on the wires and use it for power too; Recharge that battery (if it's not a primary cell)
10:26 AM sergche1991: I also thought about adding a tiny mcu like tiny 10 which job would be only holding a reset for primary 328 mcu. So whole flow will be like: 1.send "Ready bootloader" command to 328 2.328 sends "reset me" command to t10, 3.t10 resets m328, 4.328 gets new firmware over uart. So any hardware reset source related bootloaders like optiboot will work.
10:30 AM skz81: sergche1991, your flow is not optimal (or even broken...). If for some reason the 328 doesn't ACK the reset/ask the t10, you'll be stuck
10:31 AM skz81: the little chip should reset the 328 at hardware level, under no condition else that : you asked for it
10:32 AM skz81: Maybe you can just pick up an arduino ???
10:34 AM Fuchikoma: Not a very robust solution but sure there are arduino compatible "gumsticks" that might be viable
10:35 AM skz81: <Fuchikoma> Once you add a second chip you no longer need the bootloader... >> Are you sure ? IIRC the little chip (on arduino AVR i'm speaking of) resets the 328
10:35 AM skz81: and do USB to UART convertion
10:36 AM skz81: BUT you still need the arduino bootloader on the 328 to flash from UART...
10:36 AM Fuchikoma: skz81: yes, but you can have what I'll call the hypervisor chip handle everything
10:37 AM Fuchikoma: Arduino uses UART to program via te bootloader, but you could have the hypervisor chip use ISP or 1-wire instead, so no bootloader is required
10:37 AM LeoNerd: I've seen SD-card bootloaders
10:37 AM LeoNerd: I'm slightly contemplating a CC1101 radio module one >.>
10:38 AM skz81: Ha yes, I did that once to reprogram a duino with broken USB adapter. From another duino :)
10:39 AM Fuchikoma: From the perspective of minimizing wires coming to the surface that seems the way to go
10:40 AM Fuchikoma: (Still not sure how those wires will be protected...)
10:47 AM sergche1991: I'm gonna try Superseal connectors. I hope they will work. They are IP67 iirc.
10:48 AM twnqx: speaking of bootloaders...
10:48 AM Fuchikoma: Yeah but presumably they will be on the surface while farming activities re going on?
10:49 AM twnqx: i am playing with LUFA's CDC one, and i can't seem to jump back into it from userspace:(
10:50 AM twnqx: asm volatile ("jmp 0x7000"); doesn't seem to be the right way
10:52 AM sergche1991: No they will be in the soil. Farming activities go for a depth of 20-25cm. Wires will be at around 35 cm. We already have such sensors system and tractors havent broken any wire for years.
10:52 AM Fuchikoma: k
10:53 AM Fuchikoma: Having a hard time visualizing but it sound like this is a solved problem so as long as it's solved... :)
10:56 AM sergche1991: We research different farming methonds impact on soil's temperature and moisture. So we have sensors in a soil for 365 days.
10:57 AM Fuchikoma: Neat
10:57 AM Fuchikoma: I guess you put a large Lithium primary on that
10:58 AM skz81: By the way : Stopping tractor activity and letting some plant cover on the ground should really improve temp and moisture, among other parameters
10:59 AM skz81: ^^
11:00 AM sergche1991: It fits for a cute grandma's garden. But when you need to feed millions of people you need to grow crops :-D
11:00 AM sergche1991: And tbh some farming machines and methons allow water to come upwards from soil depths, some allows to preserve water, some leads to fast vaporizing.
11:01 AM Fuchikoma: Eh. There's enough farmable land in the US to rotate croplands. That doesn't make any money, though, and smaller farmers are already endangered
01:06 PM crazy_imp: hi, is there some nice serial bootloader that can be integrated into the projects sources?
01:09 PM LeoNerd: Possibly optiboot?
01:18 PM crazy_imp: LeoNerd: that one looks a bit more standalone? but now i'm unsure if i would really want an integrated one (as in: first thing inside the main is to check for the bootloader condition and allow jumping into the bootloader later on) or not :D
01:19 PM LeoNerd: It can be standalone but they may have an integration thing as well
01:20 PM crazy_imp: do you know if it can be used without the arduino stuff?
01:30 PM Fuchikoma: Another bootloader thing
01:31 PM Fuchikoma: And yes optiboot works fine with Arduino
01:35 PM * crazy_imp is looking for without
01:39 PM Fuchikoma: Without what?
01:42 PM crazy_imp: without arduino
02:05 PM PoppaVic: gcc doesn't care ;-P
02:44 PM Fuchikoma: The bootloader is not Arduino specific. Arduino IDE uses avrdude
02:44 PM Fuchikoma: The outout of Arduino IDE is exactly the same as any other compiler's
02:47 PM crazy_imp: will look into it, i only fear that it might use some of the arduino functions, so arduino-c migth be needed to compile /without/ their ide
02:50 PM Fuchikoma: All the sauce is in the fuckton of libraries the IDE adds in behind the scenes
02:50 PM Fuchikoma: The physical device knows nothing about it
11:16 PM day__ is now known as day