News:

;) This forum is the property of Proton software developers

Main Menu

www.picgraphic.com

Started by trastikata, Nov 12, 2024, 10:44 PM

Previous topic - Next topic

JonW

#140
Hello Trastikata,

I've run all the PIC18F27J53 tests on my 27J53 USB dev board (Positron8 4.0.6.7, Windows 11 25H2). The short version: all seven demos work, with built-in Windows drivers only, as you said.

Full write-up with trace records and screenshots  HERE -->(USB_WRITEUP HTML).  Please download and open in a browser

Here are the debug trace BAS files that found and traced the location of the compiler bug HERE --> DEBUG_FILES

Results:
- CDC_Serial_Poll / CDC_Serial_ISR - COM port, CDC_Data_VS_WPF sends and receives. Pass, no changes.
- HID_Data_ISR / HID_Data_Poll - pass after one change (below).
- MSC_ISR / MSC_Poll - POSITRONUSB drive, demo.txt opens, edits and saves to the RAM array; original text back after a power cycle, as designed. Pass.
- RNDIS_Root - adapter, DHCP and ping fine, but no square root came back. Pass after a work-round (below).

1. HID PID
Both HID .bas files have USB_PID 2017 ($07E1), but HID_Data_VS_WPF looks for PID $07EE. The device enumerates but the app stays on "USB not connected". With USB_PID 2030 ($07EE) it connects straight away, reads the strings and echoes Send 100/200. The hex comment above the define needs updating too.

2. RNDIS - a Positron compiler bug, not your stack
The page said "Number accepted; answer not confirmed", curl showed /status stuck at 0 and the next POST got 409. I put a UART trace on the board's CP2102 (it's there as a debug port for exactly this) and found USB_NetReadValue(0) returning "no data" with the mailbox bit set: MASK 1, PEND 1, but nWord = 0. Same at Optimiser_Level 0.

The .asm shows why. In nWriteMask = nWriteMask << pIndex, pIndex is in bank 1 (0x1BD) and nWriteMask in bank 0. The compiler puts the movlb 0x00 inside the shift loop, after the bz. With pIndex = 0 the loop is skipped, BSR stays at 1, and the AND reads two bank-1 bytes. So mailbox 0 always fails, mailboxes 1-15 would work. The write side works because nWriteIndex happens to be in bank 0.

In the demo I read mailbox 0 directly in the main loop:

    If USB_NetRxPending.0 = 1 Then
        USB_NetRxValue = nWriteValues
        USB_NetRxSequence = nWriteSequences
        USB_NetRxPending.0 = 0
        USB_Result = USB_OK
    Else
        USB_Result = USB_NO_DATA
    EndIf

and 144 gives 12,00000. For the library, GetBit/ClearBit in USB_NetReadValue, or copying pIndex to a bank-0 byte before the shift, should cure it for any mailbox (I haven't run that yet). The write-side shift by nWriteIndex is the only other variable-count shift in the include and would be worth the same treatment. I'll pass the listing to Les as well.

Small one: the MSC demo text still says "Hello from PIC18F26J50!".

All loaded with my mwboot USB bootloader and FREELOADER over the PIC's own USB, about a second per build, so it was a quick afternoon.

Nice library - very compact for what it does.

Regards,
Jon




trastikata

Thank you Jon.

The PID and "PIC18F26J50" in the MSC file are my omission. I do not have a PIC18F27J53 dev board and blindly adapted my test files thus the artifacts.

The bank anomaly is really device and actual code size depended, so it's something for Les.

Happy it worked out with the "blind" test. I plan to test most of the device families in time, and it will be fully tested library.

For me most important addition is the 16b PIC24 and dsPIC USB HID (data) support which this library makes available to Positron16.

Best regards and much appreciate your feedback.

JonW

You are welcome.  I'll tag Les in this post on the bug.

That's a lot of testing to do!

I have some 14k devices and think they will fit on the 27J53 board, but I need to mount them when I go into the lab and do a 14k USB bootloader.  I should also publish the bootloader for the 27J53, as it's really quick to change.

I'll let you know when I get it on the board.  I like the addition of the serial number; this may stop the constant enumeration of the CDC ports. After a while, they stack up and need to be ghosted; ports need to be removed.  If anyone is interested, I've built an app to remove them automatically, saving you from having to manually do each one and end up with comm port xxxxxxxx





trastikata

Thank you for the offer Jon.

I have a 14K device with USB port using the original USB stack, translated by Les years ago. So I've already tested this device .

I plan on testing device families, not all devices, so it looks a lot but in reality it is probably about 20-25 simple development boards.

By the way many thanks for the inexpensive hardware USB traffic analyzer you suggested some time ago, it comes very handy in debugging during development.

JonW

That is a great bit of kit for the money ;)   Here is another one that will be a steal to get: the SLOGICU32

I already have the 16, and they are super cheap and mega fast. They also use the Gowin FPGA, and I am using the U16 for JTAG debugging and RF ADC/DAC work, but I am waiting for the U32.  At that price, it's unbelievable.  The ONLY issue is that the GUI is a custom version of PulseView and limited input conditioning on the U16, but for $60 it's insane, and I have been decoding and finding issues in the Gowin open-source JTAG programming sequence and have written an RP2354A driverless FPGA flasher that runs 10x speed (Charlie Project, still ongoing with a new HDMI redriver IC).

charliecoutas

Jon: I noted the comment. Cheers, no hurry, no worries.
Charlie

▲