MC9S12A64 + SPI interrupt + Processor Expert

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MC9S12A64 + SPI interrupt + Processor Expert

Jump to solution
2,558 Views
mnp22
Contributor I

I'm porting a codebase from an HC11 to a MC9S12A64 using Processor Expert to assist with getting the hardware layer completed quickly. Everything is working fine up to this point. I'm using Codewarrior 5.9.0 and Processor Expert 3.00 for HCS12

 

I want to utilize interrupt driven SPI but PE only seems to support polled. Everything else can utilize interrupts and I'm not understanding why it won't for this component. I CAN write the driver manually myself, however when I make changes to vector.c and events.c for example - the next time I compile, PE overwrites my changes. I don't want to turn off code generation yet as I still have more use of PE device drivers yet to be implemented but I would like this device to be up and working before proceeding.

 

Am I missing something or is there a way around this?

MC9S12A64
Labels (1)
Tags (1)
0 Kudos
1 Solution
1,527 Views
ProcessorExpert
Senior Contributor III

Hello,

 

In case you need to use the SPI device on the MC9S12A64 microcontroller it is possible to use SynchroMaster/SynchroSlave components - these components are possible to use both with or without interrupt service. They also provide all necessary hi-level functions to control the communication.

In case you want to create your own driver for SPI device you can use Init_SPI component where you can setup also interrupt vectors and then write you own user module (*.c), which will contain the receive/send SPI routines and interrupt handlers.

For more details about differences between High Level and Init Components please follow help: CW Help->Processor Expert->Processor Expert Help->Application Design->Basic Principles->Embedded Components->Component categories.

 

 

Best regards

Jiri Rezler

Processor Support Team

View solution in original post

0 Kudos
3 Replies
1,527 Views
bigmac
Specialist III

Hello,

 

Maybe you should rename the PE generated files that you have modified, and incorporate these into your project, rather than the standard PE ones.

 

If PE supports only polled SPI, I guess that you will have to write your own driver.

 

However, for SPI master applications with fast SPI clock rates, it is doubtful that you would need interrupts.  The interrupt overheads are likely to be comparable with the polling delays.  SPI interrupts are more useful for slow clock rates, or for SPI slave operation.

 

Regards,

Mac

 

0 Kudos
1,527 Views
mnp22
Contributor I

Thanks for the response. I can rename the driver itself and have my changes remain, but PE overwrites vectors.c too.. which I can't rename as I would have 2 vector tables then when PE goes to recreate the one I renamed. I realize polled should work fine but I'm assigned to interface with the s12 exactly as the original codebase interfaced with the old HC11 which used SPI with interrupts.

0 Kudos
1,528 Views
ProcessorExpert
Senior Contributor III

Hello,

 

In case you need to use the SPI device on the MC9S12A64 microcontroller it is possible to use SynchroMaster/SynchroSlave components - these components are possible to use both with or without interrupt service. They also provide all necessary hi-level functions to control the communication.

In case you want to create your own driver for SPI device you can use Init_SPI component where you can setup also interrupt vectors and then write you own user module (*.c), which will contain the receive/send SPI routines and interrupt handlers.

For more details about differences between High Level and Init Components please follow help: CW Help->Processor Expert->Processor Expert Help->Application Design->Basic Principles->Embedded Components->Component categories.

 

 

Best regards

Jiri Rezler

Processor Support Team

0 Kudos