Closed avrs-admin closed 1 year ago
Max Gorb
Compiled at Raspbian-Jessie some warnings
[code]
gcc -DHAVE_CONFIG_H -I. -DCONFIG_DIR=\"/usr/local/etc\" -Wall -Wno-pointer-sign -g -O2 -MT libavrdude_a-ch341a.o -MD -MP -MF .deps/libavrdude_a-ch341a.Tpo -c -o libavrdude_a-ch341a.o test -f 'ch341a.c' || echo './'
ch341a.c
ch341a.c: In function 'ch341a_spi_transfer':
ch341a.c:272:14: warning: unused variable 'bytestransferred' [-Wunused-variable]
int ret, bytestransferred;
^
ch341a.c:272:9: warning: unused variable 'ret' [-Wunused-variable]
int ret, bytestransferred;
^
ch341a.c: In function 'ch341a_initpgm':
ch341a.c:381:25: warning: assignment from incompatible pointer type
pgm->spi = ch341a_spi;
^
ch341a.c: At top level:
ch341a.c:269:12: warning: 'ch341a_spi_transfer' defined but not used [-Wunused-function]
static int ch341a_spi_transfer(PROGRAMMER * pgm, const unsigned char cmd, unsigned charres) {
^
[/code]
Succesful maked it works with UsbAsp but not works with ch341a.
Max Gorb
Incompatible pointer type was passed: "...int size" instead "...unsigned int size" at ch341a.c:113 and ch341a.c:298. Unused-variables was commented but it not helps.
Max Gorb
Sorry, I have tested it more and more, and it really works! Patch needs some cleanup, but not serious. BUT it works only with fast devices, it needs LOW SCK option. For example, it fail with the atmega8L default fuses (0xD9E1 internal osc) but works fine with the same atmega8L overclocked to 12Mhz (0xC9FF external crystal). I learn more for fix it...
Alexey Sadkov
For LOW SCK option requires bitbang. It is not done because it was not required for me. I decided that the only FastSPI better than none.
Joerg Wunsch
I can understand that you are mainly interested in fast programming - but if it fails to operate on AVRs the way they are shipped (i.e., clocked with 1 MHz), it doesn't make much sense to include it. You'd need something else then to reprogram the fuses for higher clock, but if you've got "something else", why not also use it for actual programming?
github repo here for reference: https://github.com/Alx2000y/avrdude_ch341a
Some more info here. https://github.com/maxxproff/avrdude-ch341
@maxxproff Just wondering if you want to create a pull request against latest git head? Thanks.
@Alx2000y Just wondering if you want to address the questions raised by @dl8dtl and create a pull request against latest git head. Thanks.
@maxxproff avrdude has moved to github, please comment here and not in https://savannah.nongnu.org/. Thanks.
Joerg Wunsch
Thu 18 Jan 2018 10:32:35 PM UTC I can understand that you are mainly interested in fast programming - but if it fails to operate on AVRs the way they are shipped (i.e., clocked with 1 MHz), it doesn't make much sense to include it. You'd need something else then to reprogram the fuses for higher clock, but if you've got "something else", why not also use it for actual programming?
@mcuee @dl8dtl CH341A has pre-build Fast-SPI commands, which have been sniffered and reverse-engineered by @setarcos and some other people. For slow SPI it is need to use bitbang mode, all other people can't find examples of bitbang mode for CH341A (or someone found it, but doesn't want to do this work). Due this fact all opensource software for CH341 can use fast SPI only. (this is answer the questions raised by @dl8dtl) I found bitbang mode examples in CH341DPS.ZIP (it is source code of CH341DP.EXE - programmer utility for AVR from WCH). I pasted it into @Alx2000y 's patch and add native win-drivers support. I'm not programmer, I have done pre-built exe, brought it to some forums and shelve, pigeonhole, dismiss it. It was interest useful amusement, short-dated hobby. My code is very bad and very dirty, but it works. It was made in 2017, I don't remember all points of that work. I'm too lazy and I don't have enough competence to clean up this code for normal pull request, maybe later... (2022-2017 = It took 5 years to copy my sources from my old RaspberyPi-programming-toy-PC to here. Cleaning may take a some more years yet...) @mcuee, you can do it, if you want. or maybe @Alx2000y (Алексей, привет! Есть желание запилить нормальный пул-реквест? С битбангом и кул-гёрлами)))) ) All points of bitbang code stored in ch341a_bitbang.c It is for libusb driver. . For using wch win driver ch341a_bitbang_wch.c That's all, thank you for your attention.!
С битбангом и кул-гёрлами
ROTFL – It took me quite a moment to grasp it. ;-)
Please take note #1215 has been merged.
I will close this issue for now and create another issue to address the remaining issue -- for example, to add bitbang SPI support.
We will continue the discussion in #1336.
Fri 30 Sep 2016 05:03:34 PM UTC
CH341A or CH341H SPI Flash/EEPROM programmer. This code was successfully tested on Windows with libusb driver.
file #38632: 0001-CH341A-Programmer.patch
This issue was migrated from https://savannah.nongnu.org/patch/?9127