S0urceror / MSX-USB

Schematics, drivers, debug tools, to make USB devices on the MSX a reality
GNU General Public License v2.0
64 stars 18 forks source link

Installation adventures. #11

Open issalig opened 2 years ago

issalig commented 2 years ago

I create this not to mix installation problems with other stuff.

issalig commented 2 years ago

@cristianoag It asks for a repository

$ sudo apt-get build-dep openmsx
Leyendo lista de paquetes... Hecho
E: Debe poner algún URI «deb-src» en su «sources.list»
cristianoag commented 2 years ago

openmsx.org/manual/compile.html

Get Outlook for iOShttps://aka.ms/o0ukef


From: issalig @.> Sent: Tuesday, February 8, 2022 3:49:37 PM To: S0urceror/MSX-USB @.> Cc: Subscribed @.***> Subject: Re: [S0urceror/MSX-USB] Installation adventures. (Issue #11)

@crsitianoag It asks for a repository

$ sudo apt-get build-dep openmsx

Leyendo lista de paquetes... Hecho

E: Debe poner algún URI «deb-src» en su «sources.list»

— Reply to this email directly, view it on GitHubhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FS0urceror%2FMSX-USB%2Fissues%2F11%23issuecomment-1032947057&data=04%7C01%7C%7Ce9cb50ca8d4b48f0e79b08d9eb33c203%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637799429807528016%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=eYBOiwHsCy0ZHCADBnBrCP%2FXkbSdB68Tuz33KIoYxTg%3D&reserved=0, or unsubscribehttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FALSAPKWQVQQFCOIMZWJUZQ3U2FQUDANCNFSM5N3JYU6Q&data=04%7C01%7C%7Ce9cb50ca8d4b48f0e79b08d9eb33c203%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637799429807528016%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=PrtLvN3Pl48tt3%2BuAHiEvVJ86HANzDySg8VohTUkG6I%3D&reserved=0. You are receiving this because you are subscribed to this thread.Message ID: @.***>

issalig commented 2 years ago

Well, I finally compiled S0urceror's OpenMSX , in my system I needed sudo apt-get install tcl-dev not libtclcl1-dev I still have to setup download machine roms and more config stuff, but this will be tomorrow. Thanks @cristianoag for your help.

issalig commented 2 years ago

Finally, I have everything working. I started a document not to loose all the steps https://github.com/issalig/MSX-USB/blob/master/installation.md It is still work in progress.

issalig commented 2 years ago

I found a bug while I was checking my ch376s with https://github.com/S0urceror/MSX-USB/blob/master/test/usb_via_arduino/src/main.parallel.cpp

main_paralell crashed when printing iProd due to a small buffer https://github.com/S0urceror/MSX-USB/blob/2de667e102a2785ea67408f9beaa6fe030070103/test/usb_via_arduino/src/main.parallel.cpp#L1527

In get_string2 https://github.com/S0urceror/MSX-USB/blob/2de667e102a2785ea67408f9beaa6fe030070103/test/usb_via_arduino/src/main.parallel.cpp#L1084 data has size max_packet_size which is 64

But then in data_in_transfer, length is 255 and when being bzeroed it corrupts memory https://github.com/S0urceror/MSX-USB/blob/2de667e102a2785ea67408f9beaa6fe030070103/test/usb_via_arduino/src/main.parallel.cpp#L799

I fixed it by changing this line https://github.com/S0urceror/MSX-USB/blob/2de667e102a2785ea67408f9beaa6fe030070103/test/usb_via_arduino/src/main.parallel.cpp#L1084 to uint8_t data=(uint8_t) malloc (255)

Tell me if you are experiencing the same and I will propose a pull request.

cristianoag commented 2 years ago

I believe that bus just a test program. You should focus on the drivers folder.

Get Outlook for iOShttps://aka.ms/o0ukef


From: issalig @.> Sent: Wednesday, February 9, 2022 10:24:32 AM To: S0urceror/MSX-USB @.> Cc: Cristiano Goncalves @.>; Mention @.> Subject: Re: [S0urceror/MSX-USB] Installation adventures. (Issue #11)

I found a bug while I was checking my ch376s with https://github.com/S0urceror/MSX-USB/blob/master/test/usb_via_arduino/src/main.parallel.cpphttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FS0urceror%2FMSX-USB%2Fblob%2Fmaster%2Ftest%2Fusb_via_arduino%2Fsrc%2Fmain.parallel.cpp&data=04%7C01%7C%7C9ae290889480474a132008d9ebcf8285%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637800098742589029%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=erjA0z7eaBr1c2lu3R1bMcsIR3nJT0ZWuWo%2By%2FiV7d4%3D&reserved=0

main_paralell crashed when printing iProd due to a small buffer https://github.com/S0urceror/MSX-USB/blob/2de667e102a2785ea67408f9beaa6fe030070103/test/usb_via_arduino/src/main.parallel.cpp#L1527https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FS0urceror%2FMSX-USB%2Fblob%2F2de667e102a2785ea67408f9beaa6fe030070103%2Ftest%2Fusb_via_arduino%2Fsrc%2Fmain.parallel.cpp%23L1527&data=04%7C01%7C%7C9ae290889480474a132008d9ebcf8285%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637800098742589029%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=PDxHPYlZcR8%2BleWyguBxu%2BtvYWEWs5VPucQD6oKm%2Bk8%3D&reserved=0

In get_string2 https://github.com/S0urceror/MSX-USB/blob/2de667e102a2785ea67408f9beaa6fe030070103/test/usb_via_arduino/src/main.parallel.cpp#L1084https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FS0urceror%2FMSX-USB%2Fblob%2F2de667e102a2785ea67408f9beaa6fe030070103%2Ftest%2Fusb_via_arduino%2Fsrc%2Fmain.parallel.cpp%23L1084&data=04%7C01%7C%7C9ae290889480474a132008d9ebcf8285%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637800098742589029%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=U99ODtETcrZ%2BXzLp2fk5ElHRE%2B2dGgnn%2FnWOyiRWw8o%3D&reserved=0 data has size max_packet_size which is 64

But then in https://github.com/S0urceror/MSX-USB/blob/master/test/usb_via_arduino/src/main.parallel.cpp#L799https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FS0urceror%2FMSX-USB%2Fblob%2Fmaster%2Ftest%2Fusb_via_arduino%2Fsrc%2Fmain.parallel.cpp%23L799&data=04%7C01%7C%7C9ae290889480474a132008d9ebcf8285%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637800098742589029%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=3cu%2F%2BuuVBFE94UdXzC4OD6IMKvXrb321X%2BalylmFr1Y%3D&reserved=0 length is 255 and when being bzeroed it corrupts memory.

I fixed it by changing https://github.com/S0urceror/MSX-USB/blob/2de667e102a2785ea67408f9beaa6fe030070103/test/usb_via_arduino/src/main.parallel.cpp#L1084https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FS0urceror%2FMSX-USB%2Fblob%2F2de667e102a2785ea67408f9beaa6fe030070103%2Ftest%2Fusb_via_arduino%2Fsrc%2Fmain.parallel.cpp%23L1084&data=04%7C01%7C%7C9ae290889480474a132008d9ebcf8285%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637800098742589029%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=U99ODtETcrZ%2BXzLp2fk5ElHRE%2B2dGgnn%2FnWOyiRWw8o%3D&reserved=0 to uint8_t data=(uint8_t) malloc (255)

Tell me if you are experiencing the same.

— Reply to this email directly, view it on GitHubhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FS0urceror%2FMSX-USB%2Fissues%2F11%23issuecomment-1033758036&data=04%7C01%7C%7C9ae290889480474a132008d9ebcf8285%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637800098742589029%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=rUyctXB8KscAnrK8xXth0sCndpF%2F0UBOq6RcT3aLbl4%3D&reserved=0, or unsubscribehttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FALSAPKRR5AA2KL7PDUDIOSTU2JTJBANCNFSM5N3JYU6Q&data=04%7C01%7C%7C9ae290889480474a132008d9ebcf8285%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637800098742589029%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=BHSSfeW9vrqXfpQJK4NRskmkImOHqr6PWzZam3Oze5g%3D&reserved=0. You are receiving this because you were mentioned.Message ID: @.***>

issalig commented 2 years ago

Yes, it is only to check wiring and if ch376s is responding and to get properties from the devices.

S0urceror commented 2 years ago

I found a bug while I was checking my ch376s with https://github.com/S0urceror/MSX-USB/blob/master/test/usb_via_arduino/src/main.parallel.cpp

Good catch. Never happened here because the USB strings are usually not so long. I have now changed the setup package to request maximum 64 bytes as well.

And pushed the change back to GitHub.

S0urceror commented 2 years ago

Finally, I have everything working. I started a document not to loose all the steps https://github.com/issalig/MSX-USB/blob/master/installation.md It is still work in progress.

Nice write up. Would you be okay to merge all your updated instructions with the main once you consider them finished?

issalig commented 2 years ago

Yes of course, that's the idea. I will tell you when It is finished. Also i wrote info about programming the cpld and the flash so everything is documented.

issalig commented 2 years ago

I had some problems with openMSX, for some reason it did not communicate with arduino. I compared sources of main.parallel which works correctly and ch376s.cc in openMSX and the main difference is that it does not call tcgetattr, thus I removed tcgetattr from ch376s.cc and now it works good for me.

Have you experienced this behaviour?

https://github.com/S0urceror/openMSX/blob/dd40674cb36805b95b444d464765004d234c7d4e/src/usb/ch376s.cc#L38

S0urceror commented 2 years ago

Hi Issalig,

You can indeed safely remove this. Initially I retrieved the serial attributes, modified only the ones that need changing, and set them. Now that we have bzero afterwards all gets reset. No need to first retrieve the attributes.

Regards,

Mario

From: issalig @.> Date: Thursday, 10 February 2022 at 16:00 To: S0urceror/MSX-USB @.> Cc: S0urceror @.>, Comment @.> Subject: Re: [S0urceror/MSX-USB] Installation adventures. (Issue #11)

I had some problems with openMSX, for some reason it did not communicate with arduino. I compared sources of main.parallel which works correctly and ch376s.cc in openMSX and the main difference is that it does not call tcgetattr, thus I removed tcgetattr from ch376s.cc and now it works good for me.

Have you experienced this behaviour?

https://github.com/S0urceror/openMSX/blob/dd40674cb36805b95b444d464765004d234c7d4e/src/usb/ch376s.cc#L38

— Reply to this email directly, view it on GitHubhttps://github.com/S0urceror/MSX-USB/issues/11#issuecomment-1035022306, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABGC6KBBBYJ6JAEGZKW3TCDU2PHJTANCNFSM5N3JYU6Q. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you commented.Message ID: @.***>

issalig commented 2 years ago

I just write here as a reminder to change instructions (mainly paths and few other things) to make it work with recent @cristianoag linux support.