Sonsivri

Electronics => Hardware and Tools => Topic started by: Fallout on January 25, 2021, 09:53:26 09:53



Title: PEAK PCAN CAN USB adapter - DIY
Post by: Fallout on January 25, 2021, 09:53:26 09:53
for STM32F042 based hardware ( CANtact, CANable, Entreé ) - 1 channel ( acts as PCAN USB ):
https://github.com/moonglow/pcan_cantact

for STM32F407/405 dev boards - 1/2 channel ( acts as PCAN PRO/PCAN PRO FD/PCAN FD ):
https://github.com/moonglow/pcan_pro_x

Device will acts as original PCAN adapter ( PCAN/ PCAN FD/ PCAN PRO /PCAN PRO FD ) and give you full access to CAN bus through original PCAN API libs or other popular tools like BusMaster/PCAN-View. Will also works in Linux through socketcan subsystem or pcanview for Linux.

Notes:
ST bxCAN actually does not support FDCAN frames ( only classic CAN ), but i recommends you to use PRO FD firmware for 2 channel version to achive more performance in windows OS due some internal limitation of windows driver for PCAN PRO version.



Title: Re: PEAK PCAN CAN USB adapter - DIY
Post by: Wizpic on July 18, 2021, 09:01:54 09:01
I've been thinking and looking at this for a project I've got in mind and would like to start playing but I've only done picbasic and arduino along with the EPS32 but used the Arduino IDE to program these.
What software would I need to compile and up load this to an DevEBox STM32F407VGT6 ?

I need a bit of guidance fro me to get to program this and start playing with them

Thanks
Wizpic



Title: Re: PEAK PCAN CAN USB adapter - DIY
Post by: h0nk on July 18, 2021, 10:28:47 10:28

Hello Wizpic,

I've been thinking and looking at this for a project I've got in mind and would like to start playing but I've only done picbasic and arduino along with the EPS32 but used the Arduino IDE to program these.
What software would I need to compile and up load this to an DevEBox STM32F407VGT6 ?

I need a bit of guidance fro me to get to program this and start playing with them

Thanks
Wizpic

The project page says:
> Toolchain:
>
>    GNU Arm Embedded Toolchain

Depending on Your environment, You should add the GNU Arm Binutils and
GNU Make in recent versions. To build on Windows You may need a recent
MSYS Environment also.

For the upload there are several options:
- Use the Bootloader of the STM32F407. For this You will need the "DFU-Utility" from ST.
- Use a JTAG/SWD-Adapter. Recommended is a Segger J-Link, but a cheap Chinese
Clone of the ST-Link will also do. Most evalbaords have an integrated ST-Link.
You can use this also for Your own designs.

If You want to play with the Controller and get an easy entry, i would recommend
an integrated IDE for the first steps, as they will work usually "out of the box".
IAR's Embedded Workbench would be a good choice.

Good luck, and

Best Regards


Title: Re: PEAK PCAN CAN USB adapter - DIY
Post by: digitalmg on July 18, 2021, 02:37:42 14:37
I made both versions  CANtact as PCAN USB and PCAN PRO FD with STM32G407 , if you want I can send you the hex files.
For load the hex I use STM32Cube Programmer or  Segger J-Flash.

Best Regards


Title: Re: PEAK PCAN CAN USB adapter - DIY
Post by: Wizpic on July 18, 2021, 05:23:23 17:23
I was looking at getting one of these.

Would the code compile and upload via an IDE ?
Of am I thinking its to much like arduino  ;D

I know or think  that I've got to get an TJA1050 module for the front end to hook up to canbus

Thanks for the offer of the hex file I would have to have a look for a programmer if I went down that route


Title: Re: PEAK PCAN CAN USB adapter - DIY
Post by: digitalmg on July 19, 2021, 05:22:58 17:22
I did not compile with IDE, I installed arm gcc compiler(gcc-arm-none-eabi-10-2020-q4-major-win32.exe) and MinGW to be able to execute the make command.
I had problems recognizing the usb driver, when you do the usb part, you don't have to mount the 1.5km resistor between D + and 3.3v.

Best Regards


Title: Re: PEAK PCAN CAN USB adapter - DIY
Post by: Wizpic on August 07, 2021, 07:10:46 19:10
I've finally got my board as the pic above, I went to downlaod STM32 ST-LINK utility but registration/ download is under maintenance, Typical ;-)
I've been trying to work out how to compile the dam thing
I know you have mentioned   GNU Arm Embedded Toolchain thing but I aint  got a clue how to sue it I just get a Gcc command prompt dos box ??

I think once complied you can use  the STM32 ST-LINK utility to upload the hex file from the videos I've watched


Title: Re: PEAK PCAN CAN USB adapter - DIY
Post by: digitalmg on August 08, 2021, 05:12:14 17:12
You need to install MinGW, it allows programmers to use GCC compiler on a Microsoft Windows system.
To make it easier for you, I am attaching the hex file from pcan fd pro.

Best Regards.

 


Title: Re: PEAK PCAN CAN USB adapter - DIY
Post by: Wizpic on August 08, 2021, 06:33:11 18:33
That's a great and thanks,
So I just connect the BTO pin to 3.3V and using STM32 cube and download the hex file, Which I've done and it say it's there and when I read it back it reads the hex file you uploaded.
I remove BTO from 3V reboot and start PCAN view but it can't find the device, I must be doing something wrong my end ?

I'm grateful for your help and taking the time to compile the file, I'm new to the STM32 world so please bare with me

Wizpic


Title: Re: PEAK PCAN CAN USB adapter - DIY
Post by: Wizpic on August 08, 2021, 07:42:20 19:42
forget that I've got it working, I was not using the **PB14/PB15**  pins silly me ;D

Off to do do some playing


Title: Re: PEAK PCAN CAN USB adapter - DIY
Post by: Fallout on August 10, 2021, 12:20:36 12:20
Btw you can always get precompiled hex files on Release (https://github.com/moonglow/pcan_pro_x/releases) page ;)


Title: Re: PEAK PCAN CAN USB adapter - DIY
Post by: Cojonel89 on February 17, 2022, 06:14:25 18:14
Hello, I'm wondering if I could adapt and compile the PCAN-USB for STM32F103C8T6 (BluePill board). STM32F042 seems to be inferior to the F103 so I doubt the code wouldn't fit into the 64KB flash. But I don't know what are the differences between CANtact, CANable and Entreé (in terms of the resulting "seen by the system" hardware). Aren't they all PCAN-USB devices?
I'm looking forward to start working on this in the near future and to share the results with you.
Thank you!


Title: Re: PEAK PCAN CAN USB adapter - DIY
Post by: digitalmg on February 17, 2022, 07:56:39 19:56
No, STM32F103C8T6  share a dedicated 512-byte SRAM memory for data transmission and reception for USB and CAN, and so they cannot be used concurrently (the shared SRAM is accessed through CAN and USB exclusively). The USB and CAN can be used in the same application but not at the same time.


Title: Re: PEAK PCAN CAN USB adapter - DIY
Post by: Cojonel89 on February 20, 2022, 08:47:34 20:47
After all, I think I'm going to order this one: https://www.tme.eu/ro/details/mikroe-1105/accesorii-pentru-kituri-de-dezvoltare/mikroelektronika/easymx-pro-v7-stm32-mcucard-stm32f407/?brutto=1&currency=RON&gclid=CjwKCAiA6seQBhAfEiwAvPqu17YG1tOMU4lwOZWv_nY_LFIcXQ9ENOov3vpC1AKJKujoeMjUhe7KYxoCUfAQAvD_BwE (https://www.tme.eu/ro/details/mikroe-1105/accesorii-pentru-kituri-de-dezvoltare/mikroelektronika/easymx-pro-v7-stm32-mcucard-stm32f407/?brutto=1&currency=RON&gclid=CjwKCAiA6seQBhAfEiwAvPqu17YG1tOMU4lwOZWv_nY_LFIcXQ9ENOov3vpC1AKJKujoeMjUhe7KYxoCUfAQAvD_BwE)
I hope the chip version (according to the VGT6 suffix) is good for the binaries provided.


Title: Re: PEAK PCAN CAN USB adapter - DIY
Post by: Wizpic on November 26, 2023, 08:12:21 20:12
I know this is a bit of old topic and the owner has had to change it because of copyrights.
I’ve still got all the original files stored including the original hex files and was wondering if I could use an STM32F041instead of STM32F042 ?
Also if I could use STM32F041 would the original hex file be able to uploaded to the STM32F041 or would it need re compiling if it could ?
Thanks


Title: Re: PEAK PCAN CAN USB adapter - DIY
Post by: anotherandrew on November 26, 2023, 10:55:11 22:55
Could it not just update the VID to PCAN one? code now shows 0x0483 but PCAN VID is 0x0c72. Same to edit config descrptors from "XCAN-USB" to "PCAN-USB" and to make "user string" in device_get_user_string() "PEAK-System Technik GmbH"?


Title: Re: PEAK PCAN CAN USB adapter - DIY
Post by: Wizpic on November 27, 2023, 06:26:16 06:26
May be you could but i'm not sure how o do thst.

But my questions was really to ask  if I could use an STM32F041 instead of STM32F042 ?


Title: Re: PEAK PCAN CAN USB adapter - DIY
Post by: wild on November 27, 2023, 11:36:21 11:36
But.... does even a STM32F041 exists?
To my knowledge, not!

Please also take a look to the following link (use google translate):
https://www.mikrocontroller.net/topic/459746?_x_tr_sl=de&_x_tr_tl=en&_x_tr_hl=en&_x_tr_pto=wapp&_x_tr_hist=true
here is the list generated: same DIE for several different CPUs!!!
see attachment.


Title: Re: PEAK PCAN CAN USB adapter - DIY
Post by: Wizpic on November 27, 2023, 01:05:55 13:05
Sorry I meant STM32F401 instead of the STM32F402

not sure what happened there or how I missed the mistake must my fingers could not keep up how fast my brain wanted to type 😊


Title: Re: PEAK PCAN CAN USB adapter - DIY
Post by: wild on November 27, 2023, 03:34:54 15:34
same thing: the STM32F402 does not exist!
if you are referring to F405/F407, the following devices (despite different naming) are using the same chip DIE so they are equivalent:

DIE413  STM32F405O(E-G)Yx
DIE413  STM32F405RGTx
DIE413  STM32F405VGTx
DIE413  STM32F405ZGTx
DIE413  STM32F407I(E-G)Hx
DIE413  STM32F407I(E-G)Tx
DIE413  STM32F407V(E-G)Tx
DIE413  STM32F407Z(E-G)Tx
DIE413  STM32F415OGYx
DIE413  STM32F415RGTx
DIE413  STM32F415VGTx
DIE413  STM32F415ZGTx
DIE413  STM32F417I(E-G)Hx
DIE413  STM32F417I(E-G)Tx
DIE413  STM32F417V(E-G)Tx
DIE413  STM32F417Z(E-G)Tx

the same is for the F042 variant: the following chips mount the same chip DIE:
DIE445  STM32F042C(4-6)Tx
DIE445  STM32F042C(4-6)Ux
DIE445  STM32F042F4Px
DIE445  STM32F042F6Px
DIE445  STM32F042G(4-6)Ux
DIE445  STM32F042K(4-6)Tx
DIE445  STM32F042K(4-6)Ux
DIE445  STM32F042T6Yx
DIE445  STM32F048C6Ux
DIE445  STM32F048G6Ux
DIE445  STM32F048T6Yx
DIE445  STM32F070C6Tx
DIE445  STM32F070F6Px


Title: Re: PEAK PCAN CAN USB adapter - DIY
Post by: digitalmg on November 27, 2023, 03:53:08 15:53
It doesn't work, because STM32F042 is Arm Cortex-M0 and the STM32F401 is Cortex-M4-based microcontrollers.
You can use the software from the version for STM32G407. pcan_pro_fd, but the source must be modified because
the maximum clock for  STM32F401 is 84Mhz,pcan_pro_fd firmware has the clock frequency of 168Mhz.


Title: Re: PEAK PCAN CAN USB adapter - DIY
Post by: wild on November 27, 2023, 04:11:59 16:11
maybe I was not clear enough....
the F042 PCAN interface can use also ANY processors from the second list.
the F405/7 PCAN interface can use also ANY processors from the first list.


Title: Re: PEAK PCAN CAN USB adapter - DIY
Post by: digitalmg on November 28, 2023, 01:06:03 13:06
The statemen "the F042 PCAN interface can use also ANY processors from the second list", is false.
For example STM32F042Kx  have  LQFP32 packages, and you cannot use both usb and canbus peripherals at the same time,
because PA12 corresponds to CANTX and USB_DP, there is no other pin to assign CANTX to.


Title: Re: PEAK PCAN CAN USB adapter - DIY
Post by: Wizpic on November 28, 2023, 06:57:44 18:57
I've managed to find some of the original ones that I used last time,saves all the trouble
thanks


Title: Re: PEAK PCAN CAN USB adapter - DIY
Post by: Wizpic on December 01, 2023, 09:42:36 21:42
I’ve made a big mistake and ordered some of these APM32F407VGT6 instead of these STM32F407VGT6 and realised when I could not get to upload the hex file using the st-link
Opps!


Title: Re: PEAK PCAN CAN USB adapter - DIY
Post by: digitalmg on December 02, 2023, 09:14:26 09:14
You can transform st-link in j-link  https://www.segger.com/products/debug-probes/j-link/models/other-j-links/st-link-on-board/
But I haven't used any stm32 "clone", I don't know for sure if it will work for Geehy APM32F407VGT6, but you can test.


Title: Re: PEAK PCAN CAN USB adapter - DIY
Post by: Wizpic on December 02, 2023, 11:06:04 11:06
You can transform st-link in j-link  https://www.segger.com/products/debug-probes/j-link/models/other-j-links/st-link-on-board/
But I haven't used any stm32 "clone", I don't know for sure if it will work for Geehy APM32F407VGT6, but you can test.
I've just tried that and it reports no J-Link or ST-lik connected even though it is and I've pulled high the BT0 pin
That's the problem I've tried STM32 Cube and ST-Link software but both report NO ST-LINK detected on ST-LINK and no DFU on ST-Cube, Not sure if a boot loader is installed on these boards.

This the link I clicked on the wrong one and not did not notice
https://www.ebay.co.uk/itm/155813582240?hash=item24473695a0:g:J5QAAOSwMSRlH6uH&amdata=enc%3AAQAIAAAA4IKMLNJULr82n%2FIM3Gra5lFas6AWvjNkcBYr37spjk87o4HxooZbVSzAMfVTJRDRQKN8pdgDvgRUbtPiU%2FXUludle1%2FfBLOsm8mzaJ%2FHNOiUWTRTzVxn826c0NpeWx2ZOS38FDj9jywJv%2BW8hX2S3c76bfu1CRbVbr%2B6Qd3B6mjmfdCA0DPvl%2BbstSRNskEdICQtZSt8kH%2B%2F7Lqio9z4v4tcJfSir6AQLG98cOKm6x4BkIPr5w%2B6mwbQw12QissgEJmKrXw4aq%2FDyw4iQaD9al7IA2JpF%2FknhHhXtLmEr92X%7Ctkp%3ABFBMupSJo4Vj (https://www.ebay.co.uk/itm/155813582240?hash=item24473695a0:g:J5QAAOSwMSRlH6uH&amdata=enc%3AAQAIAAAA4IKMLNJULr82n%2FIM3Gra5lFas6AWvjNkcBYr37spjk87o4HxooZbVSzAMfVTJRDRQKN8pdgDvgRUbtPiU%2FXUludle1%2FfBLOsm8mzaJ%2FHNOiUWTRTzVxn826c0NpeWx2ZOS38FDj9jywJv%2BW8hX2S3c76bfu1CRbVbr%2B6Qd3B6mjmfdCA0DPvl%2BbstSRNskEdICQtZSt8kH%2B%2F7Lqio9z4v4tcJfSir6AQLG98cOKm6x4BkIPr5w%2B6mwbQw12QissgEJmKrXw4aq%2FDyw4iQaD9al7IA2JpF%2FknhHhXtLmEr92X%7Ctkp%3ABFBMupSJo4Vj)

UPDATE: I've found what can upload program to it just carrying out some testing, Lets see how it goes

 found it here
https://global.geehy.com/support/apm32/?id=383 (https://global.geehy.com/support/apm32/?id=383)

 


Title: Re: PEAK PCAN CAN USB adapter - DIY
Post by: digitalmg on December 02, 2023, 11:56:08 11:56
You cannot use the programs from ST, you must use the software from Geehy.Geehy DFU Programmer is used for DFU upgrade of APM32 series MCU.
https://www.geehy.com/uploads/tool/AN1081_APM32F4xx_Quick%20Start%20Guide.pdf
After you have converted a st-link to a j-link, for example from a Nucleo development board from ST, you will use the j-flash software from Segger to program the mcu, not the software from ST. You will need to  connect the boards to be able to program.

Update: Yes, use tools from Geehy.


Title: Re: PEAK PCAN CAN USB adapter - DIY
Post by: Wizpic on December 02, 2023, 04:05:07 16:05
I've tested tested with 2 units one connected to can hacker (transmitter) and the other one connected to P-Can view (receiver)  and played back some data that I've recorded.

And I can confirm it and it all works perfectly  ;D


Title: Re: PEAK PCAN CAN USB adapter - DIY
Post by: anotherandrew on December 05, 2023, 05:52:22 05:52
if you are referring to F405/F407, the following devices (despite different naming) are using the same chip DIE so they are equivalent:

...

the same is for the F042 variant: the following chips mount the same chip DIE:

Am curious - where do you find which die is for which chip?


Title: Re: PEAK PCAN CAN USB adapter - DIY
Post by: digitalmg on December 05, 2023, 10:41:41 10:41
Very simple, in CubeMx create a new project depending on the MCU, and then select the family series,
for example STM32F4,you order them by frequency, and those that have the same frequency have the same pattern.
Or you can find it in the attached file.


Title: Re: PEAK PCAN CAN USB adapter - DIY
Post by: wild on December 05, 2023, 12:45:25 12:45
as I first wrote:

Please also take a look to the following link (use google translate):
https://www.mikrocontroller.net/topic/459746?_x_tr_sl=de&_x_tr_tl=en&_x_tr_hl=en&_x_tr_pto=wapp&_x_tr_hist=true
here is the list generated: same DIE for several different CPUs!!!
see attachment.

Attached to the post there is an updated list of DIEs/CPUs directly extracted from the ST official files with the following command:
Code:
The source files are now in ./db/mcu and I created the file with:

grep -o "DIE..." STM* | sed -e "s/\(.*\).xml:\(DIE.*\)/\2  \1/" | sort