How does one start porting the fw to another platform?

Discussions related to the firmware code development
VK3KYY
Posts: 7478
Joined: Sat Nov 16, 2019 3:25 am
Location: Melbourne, Australia

Re: How does one start porting the fw to another platform?

Post by VK3KYY » Thu Oct 20, 2022 8:13 pm

EA5JAQ wrote:
Thu Oct 20, 2022 7:36 am
VK3KYY wrote:
Thu Oct 20, 2022 7:16 am
I recommend you change the linker file and put the application at 0x00000000, and flash it via SWD.
In which case you will also need to make the 2 codec section bin files, to replace the dummy files, and use the direct output from the build process, and not the result of the codec cleaner exe, which clears anything in the 2 codec sections, so that none of the released files contain the AMBE codec.
I'll check that out, thank you. So if I just put the application at 0x00000000 I don't need a bootloader?

Maybe if it's also possible to change the firmware's USB communication to whatever system my stock cable uses, I won't have to modify the hardware at all. I'll try to find out, but in the source code I see a lot of files about USB communication, so maybe this is too hard and it's not like changing from one pin to another. I'll investigate and see if it takes less effort to change the code or the hardware.

I've already made the 2 codec sections by copying them from my DM-1810 MCU ROM backup with the lastest beta.

I just realised that without USB, you can't upload the codeplug

The CPS will be OK, because the firmware makes the radio a USB serial device, but you will need to change the firmware to use a serial port in the MK22 MCU.

EA5JAQ
Posts: 86
Joined: Thu Jul 16, 2020 6:08 am

Re: How does one start porting the fw to another platform?

Post by EA5JAQ » Thu Oct 20, 2022 8:31 pm

VK3KYY wrote:
Thu Oct 20, 2022 8:13 pm
The CPS will be OK, because the firmware makes the radio a USB serial device, but you will need to change the firmware to use a serial port in the MK22 MCU.
Okay. I still have to investigate how all the USB communication works in the original firmware and try to replicate it in the OpenGD77 code.

It seems that the MCU sends/receives the data to a USB-to-serial chip in the actual cable (i think it has a PL2303TA integrated circuit or something like that). Then this chip opens a serial port on the computer (the OpenGD77 CPS even detects it, but obviously fails to communicate).

So, at the end of the day it’s just a COM port, the CPS shouldn’t have any trouble writing the codeplug if I can modify the firmware properly. If not, I’ll just modify the hardware and wire the connectors to the USB pins.

VK3KYY
Posts: 7478
Joined: Sat Nov 16, 2019 3:25 am
Location: Melbourne, Australia

Re: How does one start porting the fw to another platform?

Post by VK3KYY » Thu Oct 20, 2022 9:07 pm

EA5JAQ wrote:
Thu Oct 20, 2022 8:31 pm
VK3KYY wrote:
Thu Oct 20, 2022 8:13 pm
The CPS will be OK, because the firmware makes the radio a USB serial device, but you will need to change the firmware to use a serial port in the MK22 MCU.
Okay. I still have to investigate how all the USB communication works in the original firmware and try to replicate it in the OpenGD77 code.

It seems that the MCU sends/receives the data to a USB-to-serial chip in the actual cable (i think it has a PL2303TA integrated circuit or something like that). Then this chip opens a serial port on the computer (the OpenGD77 CPS even detects it, but obviously fails to communicate).

So, at the end of the day it’s just a COM port, the CPS shouldn’t have any trouble writing the codeplug if I can modify the firmware properly. If not, I’ll just modify the hardware and wire the connectors to the USB pins.
Yes. The CPS will be fine communicationg to a PL2023TA, but you will need to manually select the port, as the CPS looks for a device named OpenGD77.


Also. I forgot to confirm... The bootloader is not necessary, you could change the linker .LD files and also the VTOR address etc, so that the application is at 0x00000000

EA5JAQ
Posts: 86
Joined: Thu Jul 16, 2020 6:08 am

Re: How does one start porting the fw to another platform?

Post by EA5JAQ » Thu Oct 20, 2022 9:33 pm

Great! Thank you so much for everything. :)

I’ll try everything as soon as I have some free time. I’m sure I’ll be able to make it work.

VK3KYY
Posts: 7478
Joined: Sat Nov 16, 2019 3:25 am
Location: Melbourne, Australia

Re: How does one start porting the fw to another platform?

Post by VK3KYY » Thu Oct 20, 2022 11:10 pm

EA5JAQ wrote:
Thu Oct 20, 2022 9:33 pm
Great! Thank you so much for everything. :)

I’ll try everything as soon as I have some free time. I’m sure I’ll be able to make it work.
My experience is that it always takes much longer than expected to do anything.. Including writing firmware ;-)

EA5JAQ
Posts: 86
Joined: Thu Jul 16, 2020 6:08 am

Re: How does one start porting the fw to another platform?

Post by EA5JAQ » Mon Oct 31, 2022 8:03 pm

VK3KYY wrote:
Thu Oct 20, 2022 9:07 pm
Yes. The CPS will be fine communicationg to a PL2023TA, but you will need to manually select the port, as the CPS looks for a device named OpenGD77.
I’ve been messing around with a multimeter and I found out that the USB wiring for this radio is quite interesting.

Turns out that the MK22 connects to the PL2303TA via the UART0 pins (Port A pins 1 and 2), and then the PL2303TA handles the COM port and communicates to the PC.

But there’s more… looks like the same headphone jack pins that are connected to the UART0 pins are also connected to USB0_DP and USB0_DM!! :lol: I don’t know what TYT was thinking when they designed this hardware… they could’ve just used a normal cable with no interface on it, as USB communication is possible. I don’t know why they decided to go with UART and then convert it to USB in the actual cable.

So I don’t think I’ll have to modify anything related to USB communication. The only difference is that my DM-1801 has a couple 22 ohm resistors between the cable and the USB0 pins, and the radio I’m trying to support has a 1k resistor at D- and 100 ohm resistor at D+. I hope that doesn’t create any problems.

Another thing I found out is that UART0_RX/USB0_DP is connected to the 3.5 mm jack sleeve, which is also the PTT :roll: , so maybe that makes the hotspot mode unusable, as USB communication sometimes triggers PTT (I noticed this a long time ago using the official CPS). Looks like whoever designed this radio did nothing right :lol:

Post Reply