Skip to content

Enable CAN on DISCO_F303VC #3422

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 19, 2016
Merged

Conversation

szechyjs
Copy link
Contributor

Description

Enables CAN on DISCO_F303VC

Status

READY

@bridadan
Copy link
Contributor

Thanks for the PR @szechyjs!

Can you please take a look @bcostm or @adustm? Thanks!

@bridadan
Copy link
Contributor

/morph test

@mbed-bot
Copy link

Result: SUCCESS

Your command has finished executing! Here's what you wrote!

/morph test

Output

mbed Build Number: 1252

All builds and test passed!

@adustm
Copy link
Member

adustm commented Dec 13, 2016

LGTM, although this board is not supported by ST team.
I've looked at the STM32F303VE datasheet + the DISCO_F303VE schematics, I think you could add
PB_9 + PD_1 for PinMap_CAN_TD and PD_0 + PB_8 for PinMap_CAN_RD in the PeripheralPins.c
Kind regards

@0xc0170
Copy link
Contributor

0xc0170 commented Dec 13, 2016

@szechyjs How did you test this enablement? Can you share any test results?

@adustm
Copy link
Member

adustm commented Dec 13, 2016

Updated previous comment

@szechyjs
Copy link
Contributor Author

@adustm Thanks for reminding me about the alternative CAN pins. Its a good thing you did as the defaults are being used for user USB as well.

@bridadan
Copy link
Contributor

@adustm Thanks for the tip!

@szechyjs Do you have any automated testing results?

@0xc0170
Copy link
Contributor

0xc0170 commented Dec 14, 2016

@szechyjs Can you please sign https://developer.mbed.org/contributor_agreement/ ?

@szechyjs
Copy link
Contributor Author

@0xc0170

You accepted the Contributor Agreement on Mon 12 Dec 2016.

@0xc0170
Copy link
Contributor

0xc0170 commented Dec 14, 2016

@szechyjs Do you have any automated testing results?

Any? how was this tested?

/morph test

@mbed-bot
Copy link

Result: SUCCESS

Your command has finished executing! Here's what you wrote!

/morph test

Output

mbed Build Number: 1267

All builds and test passed!

@szechyjs
Copy link
Contributor Author

@0xc0170 I've been testing this for a little while now. Here are my findings thus far.

  • Loopback tests are successful (can_loopback).
  • Tx: I can only get activity on the Tx pins when mode is set to CAN::LocalTest or CAN::GlobalTest. I'm not sure why it doesn't work in normal mode.
  • Rx: Have yet to test. I'm waiting for some more transceivers to arrive (eta Friday).

Capture of Tx:
can_tx

@adbridge
Copy link
Contributor

retest uvisor

1 similar comment
@bridadan
Copy link
Contributor

retest uvisor

@szechyjs
Copy link
Contributor Author

I've finished my testing. Everything is working as expected. The normal mode problem went away after properly connecting transceivers. Ping-Pong test was conducted between the DISCO_F303VC and an Arduino Due. Tx & Rx worked correctly.

I did discover another issue that affects CAN on all STM32 devices. The can_read function is not implemented properly. It is supposed to return 1 only if a message was read. Looking at the code for all the STM32 targets, they all are hard coded to return 1. As a result the only way to use the can_read function reliably is with an interrupt. It looks like the NXP targets are properly implemented (https://github.com/ARMmbed/mbed-os/blob/master/targets/TARGET_NXP/TARGET_LPC176X/can_api.c#L421) We should probably open a separate issue for this.

@bridadan
Copy link
Contributor

@szechyjs Thanks for the update and, that'd be great if you could make the issue.

@0xc0170 Sounds like the automated tests are passing now and there's no breaking changes to mbed OS. I'm happy for this to come in if you are.

@szechyjs
Copy link
Contributor Author

@bridadan I opened issues #3463 and #3464 to address the read() and write() return values on STM32.

aisair pushed a commit to aisair/mbed that referenced this pull request Apr 30, 2024
Ports for Upcoming Targets

3459: Target: Add new target UBLOX_EVK_NINA_B1 ARMmbed/mbed-os#3459

Fixes and Changes

3430: Fix ci shield eeprom test ARMmbed/mbed-os#3430
3381: STM32F1 : map ST HAL assert into MBED assert ARMmbed/mbed-os#3381
3389: STM32F2 : map ST HAL assert into MBED assert ARMmbed/mbed-os#3389
3390: STM32F3 : map ST HAL assert into MBED assert ARMmbed/mbed-os#3390
3410: STM32L4 : map ST HAL assert into MBED assert ARMmbed/mbed-os#3410
3422: Enable CAN on DISCO_F303VC ARMmbed/mbed-os#3422
3442: Dev stm i2c f1 ARMmbed/mbed-os#3442
3460: KSDK I2C: Update the return value to match the API documentation change ARMmbed/mbed-os#3460
3472: [RZ/A1H]Fix TTB setting of RO_DATA area ARMmbed/mbed-os#3472
3451: Rename KSDK2 to MCUXpresso. This is the new name of this package ARMmbed/mbed-os#3451
3391: STM32F4 : map ST HAL assert into MBED assert ARMmbed/mbed-os#3391
3454: STM32: Refactor lp_ticker.c + rtc_api.c + sleep.c + rtc_api_hal.h files  ARMmbed/mbed-os#3454
3489: NUCLEO_F103RB - Correct CAN and PWM alternate-functions ARMmbed/mbed-os#3489
3405: Repair the transmit mailbox (0,1,2) empty interrupt flag not clear BUG ARMmbed/mbed-os#3405
3502: MCUXpresso I2C: Handle 0 byte write ARMmbed/mbed-os#3502
3365: [NUC472/M453] Support USB device ARMmbed/mbed-os#3365
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants