Change CAN pin assignment on TI C2000 launchpad through simulink

5 次查看(过去 30 天)
Hello users!
I am using a TI C2000 launchpad to communicate via CAN with my network. To this end, I use the eCAN XMT and RCV blocks available in the Embedded Coder Support Package for Texas Instruments C2000 Processors.
When I use the CAN B module with its default pin assignment (GPIO12 and GPIO17), everthing is fine as the Launchpad features its own transceiver that is connected to such GPIOs. The issue comes when I try to change the pin assignment of the CAN B through the Configuration Parameters interface. In such case, I connected an external transceiver (MAX 3051) to the GPIO8 and GPIO10, but it doesn't work. To check if the issue was the transceiver, I removed it and the I read the GPIOs through the oscilloscope. I found that the GPIOs do not work as they remain at 3.3V. I also tried the diverse GPIOs available in the Configuration Parameters interface of the CAN B module, but I didn't have good results.
I checked the generated C-code to figure out how the registers of the GPIOs are defined, and I found that all the registers are correct. I also tried to work with CAN A module. When I change the pin assignment, it does not work as the CAN B case.
Did anyone face the same issue?
Thanks a lot!
Salvo

回答(1 个)

Sachin Lodhi
Sachin Lodhi 2024-1-9
Hello Salvatore,
I am assuming by changing you mean to set/reset/toggle the GPIO pin. Also this is a different approach on how you can set/reset/toggle GPIO pin on C28343. You can follow these steps for your chip to achive the functionality. In order to set/reset/toggle a GPIO pin on C28343, there are few things to be taken care while building the model to auto download and execute. Follow these steps in order to setup the model for hardware execution:
  1. Select the Target Hardware as your TI C2000 on the Configset -> Code Generation pane.
  2. Select Configset -> Coder Target pane -> Target Hardware Resources -> Groups -> Build options and then select "Build action" as 'Build, load and run'
  3. Select the "Device Name" based on the target hardware you are using. In my case I tried using C28343. C28346 is the default. If you change the device name then you have to select the linker command file also accordingly or uncheck the 'Use custom linker command file' which selects the linker command file for the selected device automatically.
  4. Select the 'CCS hardware configuration file' according to hardware board using. f28x_generic.ccxml will work for C28343 control card. If you are using eZDSP board then use f28x_ezdsp_generic.ccxml. You can also generate CCXML file specific to your debug interface.
  5. Select a proper sample time for the constant block which is an input to the GPIO block. If you keep Inf as sample time then the toggle will not happen. In my case if have chosen the sample time of the "Constant" block to be 0.5. See the attached model which is configured to blink and LED for C28343 Control card.
Hope this helps.
Best Regards,
Sachin

产品


版本

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by